總的來說有兩種
第一種:一般的超鏈接傳參數
<a href="http://localhost:8080/index.jsp?name=name>手動提交 </a>
那麼,在index.jsp頁面接收參數時要用
<%= newString(request.getParameter("empcode").getBytes("iso-8859-1"),"utf-8")%>
接收,當然你的項目必須統一編碼格式,此例爲utf-8
第二種:自動刷新頁面用到的傳參數
首先,獲取action中傳來的 參數
<%
String str=request.getParameter("name");
byte b[]=str.getBytes("UTF-8");
str=new String(b,"iso-8859-1");
%>
<%
response.setHeader("refresh","1;URL=index.jsp?name="+str);
%>
在index.jsp頁面接收參數時和第一種方式相同
測試過,可以實現。
注意:一定要統一格式編碼,具體方法下次補上