日期:2014-05-18  浏览次数:20735 次

如何用JSP页面来获取超链接传来的参数?请高手帮帮忙!
我的超链接传来的参数值
checkusername.jsp?name=sadf
我应该怎么取得其值

------解决方案--------------------

<a href= "servlet名?参数1=xxx&参数2=xxx&参数3=xxx "> </a>
注:
1.“servlet名”实要提交到的servlet名,要小写!!
2.“xxx”可以跟常量也可以跟变量 如 <%=xxx%>
3.用此方法提交默认是get方式 (我还不知道怎么将它变成post方式)。
4.在servlet中接收传过来的参数:
String name1 = new String(request.getParameter( "参数1 ").getBytes( "ISO-8859-1 "), "gb2312 ");
String name2 = new String(request.getParameter( "参数2 ").getBytes( "ISO-8859-1 "), "gb2312 ");
这样避免乱码!!

以上仅供参考!