问题描述
<rule><from>/journal/detail/([0-9]+)_([0-9]+).html</from><to>/journal/detail?magid=$1&categoryId=$2</to></rule>http://localhost:8080/journal/detail?magid=3934&categoryId=3找不出原因伪静态不起作用正则也没什么问题求解决感谢
解决方案
解决方案二:
访问journal/detail/([0-9]+)_([0-9]+).html这地址会跳到http://localhost:8080/journal/detail?magid=3934&categoryId=3
解决方案三:
引用1楼sainer的回复:
访问journal/detail/([0-9]+)_([0-9]+).html这地址会跳到http://localhost:8080/journal/detail?magid=3934&categoryId=3
倒过来的
解决方案四:
1:像你那样配置,页面只能按这种格式来访问:"/journal/detail/324_243.html",访问这个地址,将会forward到"/journal/detail?magid=324&categoryId=234”这里来。2:如果你页面想“/journal/detail?magid=3934&categoryId=3”通过这种方式来访问的话:1)得在urlrewrite.xml中<outbound-rule></outbound-rule>标签文件里面做相关的配置2)同时页面访问的话,得通过jstl的c:url或者是response.encodeURL来访问才能别重写3)在<outbond-rule>中出现的特色符号要转义,例如问号“?”要把它转义,不然也会出错。4)在<outbond-rule>标签中配置相关的信息后,在<rule>标签也得配置相关的信息,否则会出现404找不到资源。5)看看3:你例子中的具体配置为:<rule><from>/journal/detail/([0-9]+)_([0-9]+).html</from><to>/journal/detail?magid=$1&categoryId=$2</to></rule><outbound-rule><from>/journal/detail?magid=([0-9]+)&categoryId=([0-9]+)</from><to>/journal/detail/$1_$2.html</to></outbound-rule>
4:jsp页面:<ahref="<c:urlvalue='/journal/detail?magid=3934&categoryId=3'/>">URLRewrite</a>OR<ahref="<%=response.encodeUrl("/journal/detail?magid=3934&categoryId=3")%>">responseEncodeURL</a>
Havealook.......