辦法一:</p><p><SCRIPT><br />function getValue(){<br />var userName = $("#userName").val();<br /> //$.post("loginAjax.action?userName="+window.encodeURI(userName),null,function(response){<br /> $.post("loginAjax",{'userName':window.encodeURI(userName)},function(response){//解決中文<br /> $("#result").html(response);<br /> }<br /> );<br />}<br /></SCRIPT></p><p><s:form action="loginAjax" method="post"><br /> <input type="text" name="userName" id="userName"/><br /> <input type="button" value="searchRight" onClick="getValue();"/><br /></s:form><br /><div id="result"><br /></div></p><p>Action裡<br /> userName = java.net.URLDecoder.decode(userName,"UTF-8");</p><p>辦法二:<br />頁面均為gb2312編碼<br /><%@ page language="java" import="java.util.*" contentType="text/html; charset=gb2312" pageEncoding="gb2312"%></p><p><SCRIPT><br />function getValue(){<br />var userName = $("#userName").val();<br /> $.post("loginAjax",{'userName':userName},function(response){//解決中文<br /> $("#result").html(response);<br /> }<br /> );<br />}<br /></SCRIPT><br />Action也不用轉碼<br />