Get request URL in JSP which is forwarded by Servlet

后端 未结 8 1437
忘掉有多难
忘掉有多难 2020-11-29 22:27

How can I get request URL in JSP which is forwarded by Servlet?

If I run following code in JSP,

System.out.println(\"servlet path= \" + request.getSe         


        
8条回答
  •  抹茶落季
    2020-11-29 23:09

    Same as @axtavt, but you can use also the RequestDispatcher constant.

    request.getAttribute(RequestDispatcher.FORWARD_REQUEST_URI);
    

提交回复
热议问题