This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to determine which page called my page  RSS feed

 
Fritz Largosa
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want my jsp page to run a method only if it is called by a certain page. Please let me know if this is possible. Thanks.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean when you say "called by"?
 
Fritz Largosa
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay I have two pages A, and B. A calls B through a response.sendRedirect("../B.jsp");. I want B to print out the link of A. Thanks.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your best bet would be to tack a query string variable to the end of the URL that you are using in your sendRedirect statement.

A response.sendRedirect statement simply sends a 302 (moved temporarily) header to the browser along with a location header containing the url in your sendRedirect statement.
I just checked using LiveHttpHeaders and the browser doesn't send a referer variable when faced with a redirect.
[ September 26, 2005: Message edited by: Ben Souther ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!