jsp

ELResolver to escape all string output of expression

I have an existing web application to which i need to add protection against script attacks. For this i need to escape string before displaying on pages. One approach is a servlet filter. Other one which i am exploring is, can i write a ELResolver which escapes output of any other ELresolvers (array, map etc) if the return is of type str...

How to rearrange data in JSP

I have a servlet ( that I cannot change ) to gather information to be displayed in on a web page. I use a bean in a JSP page to loop through the information. I tried to simplify, but my information is stored tables basically like this So for example, the bean stores information in nested arrays like this: ---2009 ------TOYOTA ----...

Free text editor to fix indentation of messy JSPs?

Hi, all. I'm developing a VXML IVR application in Eclipse, and it's chock full of messy JSPs. Some of my (inherited!) source looks like this: <%if (useLegacy) {%> <form id="getLegacy"> <block> <if cond="gblFirstRunThroughFlag=='true'"> <%--Use special "extra info" menu to retrieve the legacy ID--%> <goto next="getLegacyInfoFirst.jsp"/...

How to retrieve the name of checkbox in servlet if I provide dynamic names?

When I provide a dynamic name of checkbox inside a for loop like <input type="checkbox" name="<%=i%>" /> How can I retrieve the value in servlet? ...

I cannot deploy a basic html file in apache tomcat...

I am making a small website as my first project. I have finalized to use Java Servlets and JSP for my Server-side scripting. I am learning it from O'Reilly's HeadFirst Servlets and JSP. I decided to use Apache-Tomcat as my web server and container. I downloaded it. I even have jdk 1.6 update 21. I unzipped apache in C: It is running suc...

Reloading JSTL Tag files in Tomcat development mode

The application I just inherited defines .tag files - ie JSTL tags written in JSP and other JSTL tags. Is it possible for Tomcat to pick up on changes to .tag files and recompile/reload them without a restart, in the same manner of "development" mode for JSPs? Edit I should have noted that the context is marked as "reloadable" in Tomca...

JSP parallel include

One thing I like about JSP is include mechanism. In JSP I can simply write: <jsp:include page='/widget/foo-widget?param=value' /> It works very well when I have some sort of widget and I want incude it on some other page. The other day I think, It would be nice if include doesn't block thread control, so if I have several includes, t...

How to set date field in HTML form and how can i retrieve the date in servlets?

Hi, I need to set a date field in my html form. After submitting the form the request goes to the servlet and tha data will be stored in database. In servlets how can i retrieve the date field? Please help me. -renu ...

How to Access ArrayList in JSP page?

Hi, I am having ArrayList in DAO class contains all cutomer name details. In a JSP page I am using session scope like below: <c:set var="CustomerData" value="${ItemDataResponse.dataItemsList[1]}" scope="session"/> How to display all customer names in a drop down menu in my JSP? How to access ArrayList in my JSP? (tags like...

How to set Escape character in Oracle ?

I am writing accessing Oracle Database via JSP/JS. I would like to know whether it is possible to set ESCAPE character with those SELECT / INSERT INTO / ... commands ? I know that "SET ESCAPE \" works under SQL Plus. But is it possible to set it through coding, so that I can make sure that the correct ESCAPE character is in us. Thanks...

How to use the update statement in my jsp

Hello All, I am having an update statament in my jsp. The problem is that when I am changing the whole fields in the jsp and executed the update statament, the DB will be updated, but when I am updating a certain field, the other fields will be "" in the SQL statement. Also, I am having a problem is that I am having a miss match in the ...

When should I change the tlib-version of my tag library?

I'm after guidelines on when I should change the tlib-version in the .tld of a tag library that I author. Specifically I'm wondering if I should bump the version number if I add new tags to the library or if I should only do this if I make breaking changes to existing tags? ...

Design/Implementation Problem -- Java/JSP/Servlets

Bear with me so I can explain the layout of my problem. I am working on a website/web application that involves customers searching for real estate information. One feature on the website involves the customer performing a search on one page(well call this page A) and the following page(Page B) returns a list of line items that represent...

JSP renders weird HTML

I'm getting a very strange behaviour in one of my JSP pages. It looks like it doesn't render the complete HTML. It looks like this: <html> ... <table> ... </table> <div id= So the last line is exactly what you get when the page is rendered. Furthermore, when you do a view source you get exactly the same. This page doesn...

Server side technology with ext-js

I have chosen Ext-JS to develop the UI for my next application. I am wondering what is the best way for Ext-JS to interact with my server. Should I use plain JSPs which return a JSON response? Should I use DWR or Jabsorb which provides direct remoting with backend java code. Any other solution? I am more concerned about performance and...

What is the difference between <% ... %> and <%! ... %> in jsp

I am adding some more functionality to a page that has the two tags mentioned in the title. I noticed that the variable I declare in <% ... %> cannot be used in <%! ... %> and vice versa. What is the difference between the two and how can I declare variables that could be used in the two tags ...

Alternating table row color?

When generating html tabular data, I just wanted to hear what methods you use to alternate the table row color? For my purposes, I am using Java and JSPs on the backend. I was just planning on looping through the data and if index % 2 == 0 set it to one color else set it to something else. Is this ok? Maybe it would be better if I us...

JSP / Servlet HTTP 404 error handling

I'd like to handle HTML 404 errors in my web app. I can write this: <error-page> <error-code>404</error-code> <location>/view/error404.jsp</location> </error-page> This works perfectly, but I want to log each of the invalid urls that the users type. When I use a scriptlet in the error404.jsp like this: <% System.out...

JSTL and JSP problem in a Java web application

I am working on Java web application where I am populating 2 beans by setting up JDBC with my database. I use JSP to view the pages and I am getting proper results in form of tables. One of my table have data about drivers and passengers. The bean is being populated with the entire data. Now I need to utilize JSTL tags to only view the d...

Genarate HTML from JSP

The basic servlet jsp setup I'm familiar with .... RequestDispatcher dispatcher = request.getRequestDispatcher(resourceA.jsp); dispatcher.forward(request, response); The problem is, in addition to sending the reply back to the browser (resourceA.jsp), I need to create a second HTML output from resourceB.jsp, witch in turn will be ema...