开发者

Rewrite Rule for jsp

开发者 https://www.devze.com 2023-01-30 11:39 出处:网络
I have this URL: https://www.example.com/folder/New.jsp?par=new1 which I want to redir开发者_运维知识库ect to:

I have this URL:

https://www.example.com/folder/New.jsp?par=new1

which I want to redir开发者_运维知识库ect to:

https://www.example.com/folder/New.jsp

how should I do that?

Basically, I have par=new1|new2|new3|new4 that would need to be redirected to https://www.example.com/folder/New.jsp

I did several attempts but those were not successful.


Well, at the start of New.jsp you can just do

<%
    String par = request.getParameter("par");
    if (null != par && par.matches("new[1-4]")) {
        response.sendRedirect(request.getRequestURI());
        return;
    }
%>
0

精彩评论

暂无评论...
验证码 换一张
取 消