第一个jsp页面中的内容如下:
.....
<td>
<select name="selectuser" id="selectagentuser" style="width:200">
<option value="-33" selected>请选择</option>
<%=myFormUtil.getListuser(agentsql2)%>
</select>
</td>
.....post到第2个jsp页面(绝对路径)中,采用request.getParameter("selectagentuser")获取参数,并用System.out.println()打印结果,发现竟然显示两行,第一行是null,就是获取不到参数,第2行显示正确获取到了参数,为什么会出现两个?然后这个我这个参数获取之后要继续传递到第三个jsp页面的,发现参数都是空值.什么原因呢?
.....
<td>
<select name="selectuser" id="selectagentuser" style="width:200">
<option value="-33" selected>请选择</option>
<%=myFormUtil.getListuser(agentsql2)%>
</select>
</td>
.....post到第2个jsp页面(绝对路径)中,采用request.getParameter("selectagentuser")获取参数,并用System.out.println()打印结果,发现竟然显示两行,第一行是null,就是获取不到参数,第2行显示正确获取到了参数,为什么会出现两个?然后这个我这个参数获取之后要继续传递到第三个jsp页面的,发现参数都是空值.什么原因呢?
<%@ page language="java" import="java.util.*" contentType="text/html; charset=GBK" pageEncoding="GBK"%>
.....
<FORM name="Eform" action="<%=contextPath%>/approve.jsp" method="post">没有上传文件之类的东西,之前也用过这样的方式都能获取,但是这个怎么会显示一次获取到了一次没获取到呢?
如果你要传到页面3,必须在页面2同样要这样
<input name="selectuser" id="selectagentuser" value="${selectuser}">
这样才能在第三个页面获取到
request.getParameter("selectagentuser[1]")这样试试。