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

前端 未结 6 760

I am working on a cruise booking app using struts/tiles that uses multiple internal servlet/jsp forwards to reach the right jsp for display. But, once you r

6条回答
  •  暖寄归人
    2020-12-29 03:32

    I found a better answer in this post [ How do you detect the URL in a Java Servlet when forwarding to JSP? ]

    On the target JSP use:

    request.getAttribute("javax.servlet.forward.request_uri")

    To find out what the original URL was.

    It doesn't require you to take any extra steps on the forwarding servlet

提交回复
热议问题