aspose file tools*
The moose likes Servlets and the fly likes Redirect to another page after inserting Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Redirect to another page after inserting" Watch "Redirect to another page after inserting" New topic
Author

Redirect to another page after inserting

Loh Peggie
Ranch Hand

Joined: Jul 09, 2009
Posts: 51
Hey guys, currently I am doing on insert products into the database.
The insert form, I am making use of hashtable in multi part form so that I can upload images as well as insery data into the database.

I can insert thr details as well as the images into database. But I cannot redirect to another page that have like :Successfully inserted

Can you guys help me on it?

Thanks for your help

Appreciate it all these while
Sebastian Janisch
Ranch Hand

Joined: Feb 23, 2009
Posts: 1183
I suppose you are in a servlet.



That's about it. Note that the file name starts from the web app context root.


JDBCSupport - An easy to use, light-weight JDBC framework -
Loh Peggie
Ranch Hand

Joined: Jul 09, 2009
Posts: 51
Thanks

What happen if I am using hashtable in jsp page.


Sebastian Janisch
Ranch Hand

Joined: Feb 23, 2009
Posts: 1183
You can happily do that in a scriptlet.

Whatever comes between <% %> is plain Java. After all the JSP is translated into a Servlet.

Best practice however is to totally abstain from using scriptlets, declarations and the like.

Your servlet is the place to do the processing, the JSP is for displaying what has been processed. So generate your HashMap in the servlet, set it as a request parameter, and access the values in the JSP. That's the way to go...
Loh Peggie
Ranch Hand

Joined: Jul 09, 2009
Posts: 51
I see i see.
Which mean we have to implement the hashtable inside the servlet?


Thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61180
    
  66

Yes, as you should have no Java code in your JSPs.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Loh Peggie
Ranch Hand

Joined: Jul 09, 2009
Posts: 51
I see I see. Do you guys have any exmaples of impleenting hashtable inside servlets that allow us to upload image as well as date into the database.

Thanks.
Sebastian Janisch
Ranch Hand

Joined: Feb 23, 2009
Posts: 1183
I don't really know how a HashMap and a database upload go together.

Could you give a quick example ?
Loh Peggie
Ranch Hand

Joined: Jul 09, 2009
Posts: 51
Sure

This is the code that I make use of



Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Redirect to another page after inserting