天天看點

Struts2傳參亂碼解決方法:設定Tomcat的URIEncoding

<a href="
	<s:url action="editPublication-%{id}">
		<s:param name="queryParam.name" value="%{queryParam.name}" />
		<s:param name="queryParam.publicationType" value="%{queryParam.publicationType}" />
		<s:param name="pageBean.currentPage" value="%{pageBean.currentPage}" />
	</s:url>"
>修改</a>
           

以上傳參時候,如果有中文,可能會出現亂碼

解決方法如下:server.xml中,設定Tomcat的URIEncoding

<Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" URIEncoding="UTF-8"  />