• 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

How do I find the page where i am coming from in my current jsp page

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

How do I find the page where i am coming from in my current jsp page.
I have a page called registration.jsp where I would have to find whether I had from login page or some other link.
Please help me with this
Thank you
 
Ranch Hand
Posts: 249
Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You may want to try
 
Author
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by jaya raj:
Hi,

How do I find the page where i am coming from in my current jsp page.
I have a page called registration.jsp where I would have to find whether I had from login page or some other link.
Please help me with this
Thank you


It depends on how you get there. If you get to the page through a forward, there are request attributes (in Servlet 2.4/JSP 2.0) that hold URI information for the original request; if it's through an include, the request object still holds the original URI info; if it's through a redirect, the original info is typically lost (there's an HTTP header that may contain the info, but not always).
Your best bet is to let whatever gets you to the page include its URI in a request parameter (if its a redirect) or a request attribute (if it's a forward/include) and read the info from there in the registration.jsp file. That's what I do in the examples of a similar scenario in my book.
 
Ranch Hand
Posts: 1934
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't have my code handy.
But, where i come from; we look at the system stack and go back by 1 level in the stack. Could be the stack traversal is framework proprietary to my company thought. But that is just a suggestion.
Kishore.
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've once implemented a sorta callstack in JSP as well to keep track of where the user came from.
Enables those nice dynamic tracking links on a page showing where you've been the last X pages (which is in part why it was needed).
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic