This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

is it possible to find out which servlet forwarded request to a JSP page

 
Alan Ford
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is it possible to find out which servlet forwarded request to a JSP page, from that JSP page.
(I realize that solution with passing a paramenter would work)
 
Chris Stehno
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you should be able to pull that information from the Referer header of the request, try:
request.getHeader("Referer");
It should give you the URL that you just came from (e.g. your servlet). Depending on what you are doing with it, you may have to parse the string or check only the last part of it.
Hope this helps.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64858
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Referer won't necessarily identify the forwarding servlet; it will report what the brwser decided to put into the header. Especially if the request has been forwarded around a bit, this may or may not be useful.
My question is: why would you want to do this? Passing info forward (via attributes) is a much more conventional and architecturally pure mechanism. Back-tracking in order to affect behavior muddies the architectural picture and introduces coupling where none is needed.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic