Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring 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

finding the jsp

 
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranchers

I have got three jsp pages A,B and C.
I am forwarding the request from A,B to C.
I am using

I want to find out from which jsp request is coming?

how can I do that, any suggestions?
[ November 29, 2007: Message edited by: Madhu Sudhana ]
 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can add request parameter to the URL like:


Or

You can set an attribute in both A & B with same name but different values.
And get that attribute in C, check its value to determine from which page request is forwarded
 
Madhu Sudhana
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes,I can do that...
are there any other options, like servlet API providing any thing for this?
 
Pranav Pal
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Madhu Sudhana:
are there any other options, like servlet API providing any thing for this?



Sorry, Madhu but I am not aware of any thing for this in the servlets API
 
Madhu Sudhana
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
anybody else have idea how can we do this without setting some attributes...
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSPs, like servlets, can service any request from the web.
A request doesn't necessarily come from a page drawn by a JSP so an API method that tells you what JSP your request came from wouldn't be very useful.

If you really need to do this, parameters are probably your best bet.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well you can always try using the http header HTTP_REFERER. Note that this variable is set by the USER_AGENT i.e. the browser so it is not guaranteed to be present. This is generally not the best way to do this and I use this method mostly for tracking and data mining. You are much better off explicitly passing the last location into the next jsp/servlet or storing the last location in a stack in session or similar.

Good Luck,
Andy
 
If you two don't stop this rough-housing somebody is going to end up crying. Sit down and read this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic