Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

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
  • 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
  • Quote
  • Report post to moderator
You may want to try
 
Author
Posts: 106
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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).
 
A berm makes a great wind break. And we all like to break wind once in a while. Like this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic