日期:2014-05-20  浏览次数:20705 次

奇怪的getParameter问题
HTML code

<form action="XXXX" method="post">
<table align="center" border="0">
    <tr>
      <td align="right">
          <div id="divseltime1">日期:
          <select id="selautotime" name="selautotime" onchange="gotoshowtime(this.value)">
              <option value="3">3 Days</option>
              <option value="7">7 Days</option>
              <option value="30">30 Days</option>
              <option value="365">365 Days</option>
              <option value="1">This year</option>
              <option value="0">选择日期</option>         
         </select>
          </div>
      </td>
      <td>类型:
         <select id="seltype" name="seltype" onchange="gettype(this.value)">
              <c:forEach items="${typelist}" var="totype" varStatus="step">
                <option value="${step.index }"  <c:if test="${totype eq selserver }"> selected='selected'</c:if> > ${totype }</option>                          
              </c:forEach>              
         </select>
      </td>
       <td width="20"></td>
      <td><input type="button" value="Submit" onclick="gotosubmit()"></input></td>
    </tr>
</table>
</form>



Java code

String seltype=req.getParameter("seltype");
String autotime=req.getParameter("selautotime");



每次seltype都有值,但是autotime一直是null

这个是什么问题啊?求解~

------解决方案--------------------
你把seltype和selautotime换过来试试看,估计是电脑闹鬼了。。
------解决方案--------------------
使用firefox或者chrome,或者在ie下使用httpwatch,检查一下在表单提交时,传递了哪些参数过去。看是否有你所需要的参数。
------解决方案--------------------
HTML code
 <select id="selautotime" name="selautotime" onchange="gotoshowtime(this.value)">
              <option value="3">3 Days</option>
              <option value="7">7 Days</option>
              <option value="30">30 Days</option>
              <option value="365">365 Days</option>
              <option value="1">This year</option>
              <option value="0">选择日期</option>         
         </select>

------解决方案--------------------
关键是看selautotime这个 select有没有选择值
------解决方案--------------------
建议把 onchange="gotoshowtime(this.value)" 这个 javascript代码贴出来!
------解决方案--------------------
gotoshowtime 这个JS 有没有做别的操作 比如一些初始化的操作