jsp a href怎么传参数?

比如我要把当前input里面的name和password分别赋值为hello和123,然后传给go.jsp页面。go.jsp又怎样获取传过来的值?新手求助

jsp中超链接传值使用键值对格式,多个键值对之间用&分隔,即
<a href="show.jsp?name=tom&pass=123&score=78,5">连接</a>
取值则使用request对象即可
<%
String username=request.getParameter("name");

String userpass=request.getParameter("pass");
String score=request.getParameter("score");
%>
注意:
1、超链接传值传递的都是String类型,如果需要其他类型,则需要进行类型转换
2、超链接传值有长度限制,最长不能超过255个字符,从?后开始算起
温馨提示:内容为网友见解,仅供参考
第1个回答  2013-04-22
abc.jsp?name=hello&password=123
可以直接用个Form,submit过去。接收request.getPrama..()
相似回答