Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Servlet Design Question

Reply
Thread Tools

Servlet Design Question

 
 
Rhino
Guest
Posts: n/a
 
      07-28-2003
I'm looking for some design suggestions for a problem I'm having with a File
Upload servlet, specifically the error handling for a particular situation.

I'm using the Jakarta Commons FileUpload jar (Version 1.0) in a servlet that
provides a form and allows the user to upload up to three files to the
server. I have written code that inspects each of the files that the user
wants to upload to ensure that it is not larger than a specific size and
this code works fine. However, I am having trouble figuring out the right
way to handle the error when it occurs.

Currently, I am making two passes through the List of items obtained from
the form. The first pass simply ensures that each file that is to be
uploaded is below a certain size. The second pass stores the form inputs and
any files that are to be uploaded. After the first pass, if any errors have
been detected, I generate a page identifying the files that are too large
and display it for the user.

I would like the user to be able to spend as long as he/she needs on the
page, then press a button to return to the form so that they can adjust it
(by choosing a smaller file to upload or by blanking out the file name) and
try submitting their input again. At the moment, I tell them to use their
Back button to return to the form when they are ready.

Unfortunately, the <input type=file> fields are blank when they return. I'm
not sure why that happens but this really messes me up because I want the
form to have the exact same data on it that it had when the user pressed
Submit. All of the data in the other fields is intact EXCEPT for the <input
type=file> fields which are always blank.

Therefore, I have two questions:
1. Is there any way to change the behaviour of the form servlet and the
servlet that edits the form's input so that pressing the Back button will
return the user to a form that has all of the values still on the form
INCLUDING the file names that they put in the <input type=file> fields?
2. If not, is there some other way to design my servlet so that I can
display an error message to the user for as long as he/she needs in order to
read it, then give them some way of signalling that they are done, then
display the original input form with all of the form fields, including the
<input type=file> fields, intact?

I can't be the first person to ever encounter this situation so I'd
appreciate any guidance you could offer on how to handle this problem.

--

Rhino
---
rhino1 AT sympatico DOT ca
"If you want the best seat in the house, you'll have to move the cat."


 
Reply With Quote
 
 
 
 
VisionSet
Guest
Posts: n/a
 
      07-28-2003
"Rhino" <(E-Mail Removed)> wrote in message
news:yj9Va.2050$(E-Mail Removed).. .
> [....]
> Therefore, I have two questions:
> 1. Is there any way to change the behaviour of the form servlet and the
> servlet that edits the form's input so that pressing the Back button will
> return the user to a form that has all of the values still on the form
> INCLUDING the file names that they put in the <input type=file> fields?
> 2. If not, is there some other way to design my servlet so that I can
> display an error message to the user for as long as he/she needs in order

to
> read it, then give them some way of signalling that they are done, then
> display the original input form with all of the form fields, including the
> <input type=file> fields, intact?
>


Sounds like Struts might be the daddy.
Good luck!!

--
Mike W


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
OO design in servlet design question dave Java 5 07-17-2004 12:58 PM
Offending class: javax/servlet/Servlet.class chamikara Java 1 06-19-2004 05:42 AM
Servlet question(Tomcat, web.xml, servlet-class, servlet-name) circuit_breaker Java 2 04-04-2004 03:26 AM
Tomcat: POST from one servlet or internal class to another servlet Sean Clarke Java 1 01-07-2004 02:22 PM
how to get my servlet configuration before the servlet is initialised Andy Fish Java 4 12-17-2003 09:47 PM



Advertisments