java - How to get the original request url from a servlet/jsp after multiple servlet forwards -


I'm working on the Cruise Booking app using strokes / tiles which multiple Uses the servlet / jsp to display the right jsp for further performance. But, once you are used to present the page, after reaching the final JSP, call $ {pageContext.request.requestURL} in the JSP it Returns the path of JSP

For example

  1. Original request: forwarded to / booking / getCruiseDetails
  2. Is done: / booking / validateCruiseDeteails.jsp
  3. is forwarded to: / booking / validate user. JSP
  4. Finally it is forwarded: / Booking / Show Cruises Jsp

    Then, when I call on $ {pageContext.request.requestURL} / bookmark / showcruiseDetails.jsp me / booking / ShowCruiseDetails.jsp

    How can you get the original (client created) request URL from JSP that has reached through multiple forward I got the following post on stack overflow Used to indicate that solution, but they do not know how to find the original request URL after a number of requests.

    You can use a filter to request the attribute to the original address and then jsp

      request.setAttribute ("original", request.getRequestURL ());   

    JSP:

      $ {pageContext.request.attribute ["origin"]}   

    this works That's because the filter has set the request sender by default. This means that the filter only executes for direct client requests, for which forwarding is not included /

Comments

Popular posts from this blog

qt - switch/case statement in C++ with a QString type -

python - sqlite3.OperationalError: near "REFERENCES": syntax error - foreign key creating -

Python's equivalent for Ruby's define_method? -