urlrewriter 地址匹配中文

<!-- 景区搜索 -->
    <rule>     
       <from>^/scenic/searchbycityName_([%a-zA-Z0-9]+).html$</from>
       <to>/scenicInfo.do?act=searchScenicInfoByName&amp;cityName=$1</to>
    </rule>

 
function searchByName() 
{ 
  var cityName = $("input[name='searchCond']").val(); 
  var first=encodeURIComponent(cityName); 
  var second=encodeURIComponent(first); 
   
  $("#destinationQueryForm").attr("action",
"<%=basePath%>scenic/searchbycityName_"+second+".html") 
  
} 

 

传中文时,地址需要转码两次,本人当前编码为UTF-8;不知道为什么要转码两次,但可以匹配中文了

你可能感兴趣的:(urlrewriter,地址匹配中文)