Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

finding the jsp  RSS feed

 
Madhu Sudhana
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 ]
 
Pranav Pal
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...
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 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.
 
Andrew Headrick
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!