• 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Using JSP to redirect a client browser

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks! I'll give it a try...
 
Ranch Hand
Posts: 1072
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic