具体分两种情况:一种是在首页设置<input>,让用户输入中文,在第二页接受。另外一种是直接在首页通过参数传中文,然后在第二页接受。
1.第一种情况:first.jsp
<input name="Address" type="text" emptyok="false" size="50"/> <br/> <anchor><%=WAPUtil.str2UTF("提交")%> <go href="<%=request.getContextPath()%>/InputAction" method="get"> <postfield name="Address" value="$(Address)"/> </go> </anchor>
second.jsp
request.setCharacterEncoding("UTF-8"); String Address = request.getParameter("Address");
2.第二种情况:
String sendMsg="中文"; <anchor title="<%=WAPUtil.str2UTF("确定")%>"> <go href="sendrest.jsp" method="get"> <postfield name="sendMsg" value="<%=java.net.URLEncoder.encode(sendMsg)%>" /> </go><%=WAPUtil.str2UTF("发送")%> </anchor><br/>
接收页面: String sendMsg = request.getParameter("sendMsg"); if(sendMsg!=null) sendMsg = java.net.URLDecoder.decode(sendMsg); System.out.println("sendMsg:"+sendMsg);
结果: sendMsg:中文

|