JSF代碼:
後臺取值:
這裏file值總是亂碼,經過一番嘗試,終於解決了,把編碼格式統統設置成utf-8就可以了:
1.頁面編碼:
<head>
<meta http-equiv="Content-Type" content="text/xhtml; charset=utf-8"/>
</head>
2. tomcat編碼:
設置server.xml,找到這一段
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
加上URIEncoding="utf-8",就OK了!!!
java的亂碼問題確實很煩