• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Redirecting in servlets

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys, I'm having problems with my redirection code for a java servlet code.

When a user clicks the Register button...
>the /regisration_page servlet will be shown wherein it have requestDispatchers composed of 3 fragments (banner.jsp,footer.jsp,content.jsp)
>the content.jsp contains the <form action="/register" method="POST"> when the user finishes filling up the necessary information, the servlet /register will then insert the data into the database.. well it work fine..
>but then i need to redirect the user to a page that will notify him if the registration is successful.

I tried the following...

In the /register servlet I inserted the ff in the doPost:



and I created a new fragment named registrationStatus.jsp that will get the parameter



And then how will I show the page to my user?
I thought of using the processRequest in the /register servlet wherein I used the RequestDispatcher to combine 3 jsp fragments and send it back to the client:



And its not working... I don't know what I did wrong.. is there something wrong with my logic???
Help will be much greatly appreciated. Thank you!
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, but I cannot get past this:
You realize that this will completely mask any exceptions that are thrown?
 
Ranch Hand
Posts: 672
4
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Java exception messages are written in a way, so that it will be easy to debug the problem and by having a empty catch block, you are not helping yourselves and is a very poor thing to do.
 
reply
    Bookmark Topic Watch Topic
  • New Topic