• Post Reply Bookmark Topic Watch Topic
  • New Topic

Using JSP to redirect a client browser  RSS feed

 
pwallace25
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I've seen many examples of JSP pages being used to process data from an html form. Most of my book examples process the data received in some way and then compose a new web page with the results and fire it back to the web browser. I'm quite comfortable with how this works. In my new situation I need a JSP to actually redirect the browser to the address of an existing html page (based on the option selected by an user in a html Form Selection element) rather than try to compose a web page on the fly to send back to the browser. How do I do this?
Now while on this theme lets make it a bit more complicated...
Lets say I have an html page with two frames which we shall call TOP and BOTTOM. In the TOP frame the "top" html page includes the html form which makes use of the "Select" form element to give the user a drop down menu of options. Depending on the option selected the user must be redirected to a new web page which must be displayed in the bottom frame. When they select an option I need to have a JSP page process the form selection and redirect there browser to display the selected html page in the BOTTOM frame.
Any thoughts?
 
Jason Brawner
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. Use the TARGET attribute of the FORM tag to direct the action to the bottom frame.
2. If your just going to process the data and redirect to static page, I'd suggest using a servlet rather than a jsp. It's much easier to process data in a servlet (or bean) than in a JSP. Regardless, use the RequestDispatcher object to redirect or forward to the static page. A simple if-else or case-switch may be all thats required to determine the appropriate page.
Hope this helps. Let me know if you need any further explanation.
 
pwallace25
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks! I'll give it a try...
 
ersin eser
Ranch Hand
Posts: 1072
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
pwallace25

Please read the Javaranch Naming Policy and change your publicly displayed name to comply with our unique rule. Thank you for your cooperation.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!