• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Bear Bibeault
  • Liutauras Vilda
  • Devaka Cooray
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Redirect to another page after inserting

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:D

Appreciate it all these while:)
 
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suppose you are in a servlet.



That's about it. Note that the file name starts from the web app context root.
 
Loh Peggie
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks:)

What happen if I am using hashtable in jsp page.


 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see i see.
Which mean we have to implement the hashtable inside the servlet?


Thanks:D
 
Marshal
Posts: 67356
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, as you should have no Java code in your JSPs.
 
Loh Peggie
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't really know how a HashMap and a database upload go together.

Could you give a quick example ?
 
Loh Peggie
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure:)

This is the code that I make use of:)



Thanks:)
 
Beware the other head of science - it bites! Nibble on this message:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!