在我的 JSP 页面index.jsp中,我有
<c:import url="/hello.jsp?name=user" />
我有一个映射到的过滤器,hello.jsp在这种情况下如何获取包含 url /hello.jsp?name=user。如果我尝试 request.getUrl(),它会给我/index.jsp.
在我的 JSP 页面index.jsp中,我有
<c:import url="/hello.jsp?name=user" />
我有一个映射到的过滤器,hello.jsp在这种情况下如何获取包含 url /hello.jsp?name=user。如果我尝试 request.getUrl(),它会给我/index.jsp.
您可以使用getQueryString()
它已作为请求参数发送。只是ServletRequest#getParameter()用来获取它。
String name = request.getParameter("name"); // "user"
// ...