This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JSP and the fly likes Help for JSP? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » JSP
Bookmark "Help for JSP?" Watch "Help for JSP?" New topic

Help for JSP?

Tony Tranquil

Joined: Sep 23, 2003
Posts: 24
Hi all,
I working on a project, it provides functionality to upload file using JSP/Servlet. In the first JSP page, there is file location and submit button. After user select a file to upload and click submit button, a message, like "sending file to XXXX", will be shown on the screen. Once uploading and validation are done on the server-side, a successful/error msg will be shown to user.
Here I have a question for the "sending..." msg and the successful/error msg. They should be put in one jsp page or in two separate page? how to implement them?

Thanks for any help!
Baka Neko

Joined: Dec 09, 2003
Posts: 14
Hey..maybe i can help ya out
I guess your fileupload page looks similiar to this one
<FORM METHOD="POST" ACTION="files.jsp" ENCTYPE="multipart/form-data">
It then links to the "files.jsp" where all my uploaded files are validated.
If you got also a jsp file doing that for you, you can simply do something like this to show the messages you wanna show:
<h1>Upload done!</h1>
<meta http-equiv="refresh" content="5; url='yournextpagehere.jsp'">
You�ll get redirected to your next jsp page automatically.
Hope this will help you a little bit.
Baka out
Faisal Khan
Ranch Hand

Joined: Jun 29, 2003
Posts: 285
Originally posted by Tony Tranquil:
Here I have a question for the "sending..." msg and the successful/error msg. They should be put in one jsp page or in two separate page? how to implement them?

The decision to use one page for success and failure is entirely up to you, both will work. For example, if you use one page then you can use some form of flag to indicate which message to show.
e.g. (file - end.jsp):
if ( success ) out.print( "successful..." );
else out.print( "faliure..." );
You can also at the time of success or failure decide to redirect to different pages:
e.g. (file - uploading.jsp):
if ( success ) response.sendRedirect("success.html");
else response.sendRedirect("failure.html");
I tend to prefere the latter method, where I can do the uploading etc inside the controller (ideally a Servlet) and then use RequestDispatcher or equivalent to forward to the appropriate view.

The secret to creativity is knowing how to hide your sources.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Help for JSP?
It's not a secret anymore!