Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Can I find out the "path" information from the destination JSP ?

 
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my "form.jsp", I have the following thing --

<html:form action="/submit">

the "/submit" action actually takes the parameters from "form.jsp" and handles some logic then forward to "result.jsp". So the URL looks like "http://localhost/myapp/submit.do". Now my question is --

In the "result.jsp" how can I get the parameter of "submit.do" ? i.e. how can I find out which "path" was taken before it was forward to current "result.jsp" ? I have tried the following but none of them works --

request.getServletPath();
request.getRequestURI(); request.getRequestURL(); none of them returns "submit.do". so, can I get it and how ?

thanks.
 
Author
Posts: 531
Mac OS X Netbeans IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
You want to send user back to his/her initial page?
then first of all you need to save your current path in as a session variable
or you should use a header variable called Referer
request.getHeader("Referer)
which will return Referer page.
so :
in your action retrive the Referer variable , set it as a session variable
in the result.jsp you can use that path for what ever you want.
if you need more details i would help you
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic