Get URL of page requested that caused a 404

前端 未结 2 1020
梦如初夏
梦如初夏 2021-01-12 16:54

How would I get the URL of the page that was requested that caused the 404 error?

For example, I type I go to http://example.com/path/does/not/exist/index.jsp I alre

2条回答
  •  说谎
    说谎 (楼主)
    2021-01-12 17:28

    If forward was used to go to the error page, you can obtain the original request URL by

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

    or by EL

    ${requestScope['javax.servlet.forward.request_uri']}
    

提交回复
热议问题