jsp<a href>传值 链接到一个新jsp页面,传递表单的值,一个文本框的,一个事单选按钮的,怎么传递,用js吧?该怎么写 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <a href="query.jsp?jumpPage=${(p-1)}">上一页</a> <a href="js的方法"></a>这样你可以随便写js,想怎么传都可以直接用?加参数也可以 <html><head><title>表单</title><script>function f(){//测试var username=document.form1.username.value;alert(username);window.location="example.jsp?name="+username;}</script><head><body><form name="form1" action="" method=""><input type="text name="username" id="username"/><input type="button" value="提交" onclick="f()"></form></body></html><%@ page contentType="text/html; charset=GB2312" language="java"%><html> <body>传递过来的值:<%=request.getParameter("name")%> </body> </html> 把传过来的值赋给新页面的方法:<input type="text name="username" id="username" value="<%=request.getParameter("name")%>"/> text的 我会,就不会单选框的啊 一样的啊,request.getParameter("name") name为你单选框的名字就行了啊 一样的啊,request.getParameter("name") name为你单选框的名字就行了啊 <form name="form_query" action="" method="post"><input type="button" value="value" onclick="f()" name="bb"><script language=javascript> function f(){ window.location.href='t.jsp?name=' + document.form_query.bb.value;} </script> 新手 求助 谢谢 简单的网络编程 关于java中文件(File)的问题 关于i++的问题 请教一个编码规范的问题 jbuilder7中怎么解决鼠标滚动?怎么注释选中的多行,怎么撤销注释的多行(快捷键)? 寻书:数据结构与算法分析(最好是java描述的) java是否能很好的进行数据库编程呢? 那为大侠出手想告:上溯造型和下塑造型的本质问题!! jbuilder开发的应用,如何制作java的安装程序? Swing中窗口关闭涉及到的系统资源问题!! 关于自增操作符(++)的讨论
这样你可以随便写js,想怎么传都可以直接用?加参数也可以
<html>
<head>
<title>表单</title>
<script>
function f(){
//测试
var username=document.form1.username.value;
alert(username);
window.location="example.jsp?name="+username;
}
</script>
<head>
<body>
<form name="form1" action="" method="">
<input type="text name="username" id="username"/>
<input type="button" value="提交" onclick="f()">
</form>
</body>
</html><%@ page contentType="text/html; charset=GB2312" language="java"%>
<html>
<body>
传递过来的值:<%=request.getParameter("name")%>
</body>
</html>
把传过来的值赋给新页面的方法:
<input type="text name="username" id="username" value="<%=request.getParameter("name")%>"/>
<input type="button" value="value" onclick="f()" name="bb">
<script language=javascript>
function f()
{
window.location.href='t.jsp?name=' + document.form_query.bb.value;
}
</script>