通过form表单传来的值在Action中都接不到, debug进入看都是null, 请求帮忙

解决方案 »

  1.   


    if(type.equals("sel")){
    System.out.println("providerId"+providerId);
    System.out.println(selectedStones);
    String[] stoneIdList = selectedStones.split(";");这里为空  
    providerId跟selectedStones的get和set都有了  form:<form action="providerAdmin/updateProvider.action?type=sel" name="providerForm" method="post" onsubmit="return check();">
      
        <table width="80%" border="0" align="center"  cellpadding="3" cellspacing="1" class="table_style">
        <tr class="head">
         <th width="260px">可供选择的石材</th>
         <th width="100px">操作</th>
         <th width="260px">供应商所有石材具体情况</th>
        </tr>
        <tr>
          <td style="text-align: center;">
           <input type="text" class="search-input" value="${stoneName }" name="stoneName" id="stoneName" onkeyup="loadStone()" title="输入石材名字搜索关键字" />
            <br/>
            第<input type="text" value="1" name="pageNo" id="pageNo" size="1"  style="text-align: center;"/>页
           <input type="button" value="上一页" onclick="loadStone('left');" id="leftBtn"/> 
           <input type="button" value="下一页" onclick="loadStone('right');"  id="rightBtn"/>
           <div id="allStonesDiv">
    <select  class="sel" multiple="multiple" size="20" name="allStones" id="allStones" 
    ondblclick="move(this.form.allStones,this.form.selStones)">
    <c:forEach items="${stonesList }" var="stoneItem">
    <option value="${stoneItem.id }">
    ${stoneItem.chineseName }
         <c:if test="${fn:length(stoneItem.chineseAlias) > 0}">
    /${stoneItem.chineseAlias }
    </c:if>
    </option>
    </c:forEach>
    </select>
    </div>
          </td>
          <td style="text-align: center; background-color: #ffffff;">
         
          <input type="button" class="btn" value="全部右移" onclick="moveall(this.form.allStones,this.form.selStones)" name="B1">
           <p></p>
           <input type="button" class="btn" value="选中右移" onclick="move(this.form.allStones,this.form.selStones)" name="B2">
    <p></p>
    <input type="button" class="btn" value="选中左移" onclick="move(this.form.selStones,this.form.allStones)" name="B3">
    <p></p>
    <input type="button" class="btn" value="全部左移" onclick="moveall(this.form.selStones,this.form.allStones)" name="B4">
          </td>
          <td style="text-align: center;">
           <select class="sel" multiple="multiple" size="20" name="selStones" id="selStones" 
            ondblclick="move(this.form.selStones,this.form.allStones)">
            <c:forEach items="${selectedStonesList }" var="item">
    <option value="${item.id }">
    ${item.chineseName }
         <c:if test="${fn:length(item.chineseAlias) > 0}">
    /${item.chineseAlias }
    </c:if>
    </option>
    </c:forEach>
           </select>
           <input type="hidden" id="selectedStones" name="selectedStones" />
          </td>
        </tr>
        <tr>
         <td  colspan="3" class="left_title_2">
         <input type="hidden" value="${provider.id }" id="providerId" name="providerId" />
    <input type="submit" class="input-submit" value="下一步">
    <input type="hidden" value="${provider.id }" name="provider.id" id="provider.id" />
    <input type="hidden" value="${providerName }" name="providerName" />
    <input type="hidden" value="${pageNo }" name="pageNo" />
    </td>
        </tr>
      </table>
      </form>
      

  2.   

    你看看 页面本身有值吗 下面这俩
    <input type="hidden" id="selectedStones" name="selectedStones" />
    <input type="hidden" value="${provider.id }" id="providerId" name="providerId" />
      

  3.   

    有值  我试过了  ${provider.id }在页面中能显示出来
      

  4.   

    type 你的这个Action后的这个type参数也必须加get set 方法,不知道你加这个属性了吗?
    private String type;
      

  5.   

    你的Type的值是sel吗?你试试把sel写外面
    <form action="providerAdmin/updateProvider.action?type="+"sel" name="providerForm" method="post" onsubmit="return check();">
    你可以试一下
      

  6.   

    你的这个有语法错误的啊。连接的用&符号的
    <form action="providerAdmin/updateProvider.action?type="+"sel&" name="providerForm" method="post" onsubmit="return check();">
      

  7.   

    谢谢各位  问题自己解决了   是拦截器的问题  重新写个Action就可以了