jsp

Unable to delete a file after reading it.

I'm serving a file from the file system dynamically with a jsp Here's my code: <%@ page import="java.io.*,java.util.*" InputStream in = null; OutputStream responseOut = null; File file = new File(request.getAttribute("fileToServe")); try{ in = new FileInputStream(file); responseOut = response.getOutpu...

handling forms with mutliple buttons / posts

I have the following form setup: <html> <head></head> <body> <form method="post" enctype="multipart/form-data" action="FileUpload"> <table> <th>WEX SI Online Validation</th> <tr> <td>Step 1: Select File for Validation: </td> <td><input name="filename" type="file"/></td> </tr> ...

Accessing java-based DOM tree directly from JSF/richfaces

Based on this question I have a couple of other questions: 1) the map in this question which is made available to jsf is actually one of a number, so i'm now not sure what the backing bean method's return type should now be. if i modify it's current Array<String> return type to Array<Map Integer, Map<String, String[]>>> (or ArrayList<M...

using the FOR loop to catch mutliples of the same number

I have a String that holds the value of an ID number from a query that I am parsing into an Integer. I need a FOR loop that checks everytime a certian number appears in the query more than five times. I am displaying this imformation on a JSP page. So far I have: while (rs1.next()){ String TicketNumber = rs1.getString("XXXX...

Java List use through use of JSTL <c:forEach>

Hello If I have a JSF backing bean return an object of type ArrayList, I should be able to use to iterate over the elements in the list. Each element contains a map and although the question of how to access the map content through JSTL has been answered here, if I pass an array of such maps, I can't find how to iterate over them and ...

Escaping html in Java

How do I make sure I don't escape something twice? I've heard that its good practice to escape values as you receive them from a form, and also escape when you output. That way you have two chances to catch something. ...

JSP pages in Eclipse do not indent?

I've read this article describing how to format jsp's in eclipse. I have WTP installed and the jsp tags are colored. However, there is no indenation on the html (i.e. <html> and <body> etc. are all at the same level). I've tried Source -> Format with no success. Is this a bug? ...

Backing bean String[] access in JSF

First, apologies if you've been involved with my recent questions. As this isn't a discussion forum, and comments are limited, my last hope is to ask a specific question with actual code in the hope that somehow I can reach the bottom of my problem. OK. I've a backing bean called PrismBacking with this pertinent code: public clas...

Apache commons -> File Upload -> parseRequest() error

Apache returns this error while trying to upload a file (I only kept the first lines of the stacktrace and root causes): HTTP Status 500 - type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: Exception in JS...

Error in jsp and servlets

Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:505) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267) ...

On load of JSP, selectively change Jquery declaration to input values.

Gentlepeeps, I'm new with Jquery. Apologies in advance for the basic question. I'm trying to bring in Jquery to our struts/jsp environment. Existing code is riddled with pure javascript. I'm writing a validation rule using JQuery's validation plugin like so: $("#advanceValidateform").validate({ rules: { advanceAmt1: { min: 0, m...

enable caching of images specifying a modified date

Hi.... I've a jsp page which loads many images. I'd like to cache the images for faster loading. I'll explain my idea, please correct it if it's wrong. I'm calling the picture loading servlet for each image and return as a BLOB. My idea is to add a modified date with the image and the other values like Last-Modified, expires, Cache-con...

How can I disable Tomcat caching completly?

I'm having trouble with a site im currently working on. We are trying to make facebook connect comments widget. The widget loads every time we make a new request that responds with a 200 OK status. But when it returns with a 304 Not Modified the widget wont load. It all points out to a caching issue. I tryed changin the context.xml <C...

Generic Database Code Table Editor

Where can I find a generic editor (JSP using Oracle's ADF) for create, read, update, and delete on any table? Example usage: User selects the name of a table. User then adds a new row, or updates/deletes an existing row. User saves the changes. Foreign keys would appear as drop-down lists, and all others as af:inputText. (The user-f...

Will a 302 redirect maintain the referer string?

Hello all, I need to redirect the user from one page to another, but I need to maintain the original referer string. So, for example, if they start out on http://www.othersite.com/pageA.jsp, click a link that takes them to http://www.mysite.com/pageB.jsp, which then executes a 302 redirect to http://www.mysite.com/pageC.jsp, I need th...

Reusing a template page in Spring MVC

What is the best and easiest technology from the followings? Tiles, velocity or freemaker? Thank you. ...

How to script scala directly in JSP pages?

Is there any scala JSP engine, or is there going to be any? i know about the scala web framework lift, but it seems more like tags. i am looking for a way to script like PHP. thanks. ...

How to avoid race condition

What are the best ways to avoid race conditions in jsp at the same time not to slow down the process.I have tried isThreadSafe=false synchronized(session) however is there any other alternate solution is available? ...

where to place properties files in a jsp servlet web application

In my web application I have to send email to set of predefined users like [email protected], so I wish to add that to a .properties file and access it when required. Is this a correct procedure, if so then where should I place this file, I am using Netbeans IDE which is having two separate folders for source and JSP files, advice solicite...

Simple database web application with Eclipse and Glassfish

Hello I just started to learning Eclipse with Glassfish server. I was looking around how can I make simple database web application, but can't figure out yet. I downloaded the Glassfish bundle for Eclipse. I need to create simple database ( perhaps one table ), and connect the database with simple web application. How to do that in Ec...