怎样在jsp中select下拉框选择的参数传递给另外一个jsp页面? 急~~~~~~~~~` 怎样在jsp中select下拉框选择的参数传递给另外一个jsp页面? 急~~~~~~~~~` 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 放置到表单中,就传递到下个jsp <select name="sel"> <option value="a">a <option value="b">b <option value="c">c</select>提交到另一个页面取参数用<% String str=request.getParameter("sel");%> <select name="sel" onchange="transfer(this.value)"> <option value="a">a <option value="b">b <option value="c">c</select><script> function transfer(str){ //把这个参数传递到你想要的页面 }</script> <form id="form" action="a.jsp"><select name="sel" onChange="submit();"> <option value="a">a <option value="b">b <option value="c">c</select></form><script> function submit(){ document.getElementById("form").submit(); }</script>提交到另一个页面取参数用a.jsp里取值<% String str=request.getParameter("sel"); out.print(str);%>非要写完整.晕... 不好用啊 小弟的代码如下 <form name="Form1" method="post" action="/pdf.jsp" id="Form1"><p></p> <span class="h1" align="left"> 生成报告</span><br /><br /><br /> <div> <TABLE cellSpacing="1" cellPadding="1" width="500" border="0"> <TR> <TD width="75"><span class="style1"> 设备选择</span></TD> <TD width="150" colSpan="2"> <html:select property="deviceId" name="pdfdevicelistForm" onchange="tijiao()"> <html:option value="">--- 所有设备 ---</html:option> <html:optionsCollection name="pdfdevicelistForm" property="deviceList" /> </html:select> </TD> </TR> </TABLE> <P></P> </div> <a href="<%= request.getContextPath()%>/pdf.jsp?">生成报表</a><P> </P><P></P> </form>javasript 里面的 tijiao()函数 怎么写呢?? 要把参数传到pdf.jsp中 <select name="sel" onchange="transfer(this.value)"> <option value="a">a <option value="b">b <option value="c">c</select> <script> function tijiao(){ document.all("Form1").submit(); }</script> 改为:onchange=tijiao(this.value)<script> function tijiao(deviceId){ document.Form1.action="<%= request.getContextPath()%>/pdf.jsp?deviceId="+deviceId; }</script>如何?? 你不提交表单...改它的action有什么用啊?提交表单才能到下个页面取值我劝LZ还是好好补补HTML和JavaScript基础 哈哈 忘了加上 document.Form1.submit()了 笔误 document.Form1.action="<%= request.getContextPath()%>/pdf.jsp?deviceId="+deviceId;这里本身就是多余的...提交表单已经把数据传递过去了 用你的方法 我在pdf.jsp中取到的deviceId为null 怎么回事? 你在pdf.jsp里怎么取的看看取值的名字和select的名字是否一致 String str=request.getParameter("pdfdevicelistForm"); 显然名字写错了String str=request.getParameter("deviceId");这才是他的名字你可以在页面上打开源文件查看select的name属性 <html:optionsCollection name="pdfdevicelistForm" property="deviceList" />是不是你这个deviceList的值有问题咧?只有显示没有value onchange()事件中放入session:session.getAttribute("","");取值后再把session remove();可以传递到任何页面. 错误 纠结 请教一个正则表达式:只能输入中文英文不能输入数字 关于WEB服务器,达人进 急,急 ,急!jxl 用已有的excel模板,创建新的文件 用jbuilder制作jsp页面,如果实现背景单一,而不是全屏拉伸? 问个nginx+resin服务器的问题,不知道是在这里问不... 这样写,为什么不能新开窗口?帮忙看看 --100分--问个简单的问题! resin老是重启的问题! 请教!! 问个关于注册码的问题 struts。。在普通javabean中连接数据库
<option value="a">a
<option value="b">b
<option value="c">c
</select>提交到另一个页面取参数用
<%
String str=request.getParameter("sel");
%>
<option value="a">a
<option value="b">b
<option value="c">c
</select><script>
function transfer(str){
//把这个参数传递到你想要的页面
}
</script>
<select name="sel" onChange="submit();">
<option value="a">a
<option value="b">b
<option value="c">c
</select>
</form>
<script>
function submit(){
document.getElementById("form").submit();
}
</script>提交到另一个页面取参数用
a.jsp里取值
<%
String str=request.getParameter("sel");
out.print(str);
%>非要写完整.晕...
<form name="Form1" method="post" action="/pdf.jsp" id="Form1">
<p></p>
<span class="h1" align="left"> 生成报告</span>
<br />
<br />
<br />
<div> <TABLE cellSpacing="1" cellPadding="1" width="500" border="0">
<TR> <TD width="75"><span class="style1"> 设备选择</span></TD>
<TD width="150" colSpan="2">
<html:select property="deviceId" name="pdfdevicelistForm" onchange="tijiao()">
<html:option value="">--- 所有设备 ---</html:option>
<html:optionsCollection name="pdfdevicelistForm" property="deviceList" />
</html:select>
</TD> </TR> </TABLE>
<P></P>
</div> <a href="<%= request.getContextPath()%>/pdf.jsp?">生成报表</a>
<P> </P>
<P></P>
</form>
javasript 里面的 tijiao()函数 怎么写呢?? 要把参数传到pdf.jsp中
<option value="a">a
<option value="b">b
<option value="c">c
</select>
function tijiao(){
document.all("Form1").submit();
}
</script>
onchange=tijiao(this.value)<script>
function tijiao(deviceId){
document.Form1.action="<%= request.getContextPath()%>/pdf.jsp?deviceId="+deviceId;
}
</script>如何??
提交表单才能到下个页面取值
我劝LZ还是好好补补HTML和JavaScript基础
这里本身就是多余的...
提交表单已经把数据传递过去了
怎么回事?
看看取值的名字和select的名字是否一致
String str=request.getParameter("deviceId");
这才是他的名字你可以在页面上打开源文件查看select的name属性
是不是你这个deviceList的值有问题咧?只有显示没有value
session.getAttribute("","");取值后再把session remove();
可以传递到任何页面.