我从一个jsp页面中将toId传到一个action中,并且我在action中设置了一个println的函数来打印它来判断值是否传进来。
结果显示toId的值并没有被传进来,但是这种传值的方法我在别的地方都好使,为什么就是这个页面没法传真的很奇怪!!!!!谢谢帮忙
传值的jsp页面 红色的即为传值的方法,这个页面中的值包括toAddress,toNation等我都试过,都没传出来,感觉跟奇怪
<s:iterator value="list"> 
    <tr>
      <td><s:property value="toId"/></td>
      <td><s:property value="toAddress"/></td>
      <td><s:property value="toNation"/></td>
      <td><s:property value="toCode"/></td>
      <td><s:property value="reachAddress"/></td>
      <td><s:property value="reachNation"/></td>
      <td><s:property value="reachCode"/></td>
      
      <s:url [color=#FFFF00]action="searchOneTo" id="url1">
    <s:param name="toId" value="toId" />
  </s:url>
      <td> <div align="center"><a href=" <s:property value="#url1"/>" target="changeTo.jsp">修改</a> </div> </td>[/color]
      
      <s:url action="deleteTo" id="url4">
       <s:param name="toId" value="toId"></s:param>
      </s:url>
      <td> <div align="center"><a href="<s:property value="#url4"/>">删除</a></div> </td>
     </tr>
     </s:iterator>----------------------------------------------------------------用来接收数据的action中的searchOneTo方法
public String searchOneTo()throws SQLException{

try {
System.out.println("toId_action="+toId+"");打印出来的值为0,说明数据并没有传进来

setTo(guestFacade.searchOneTo(toId));
return "to_searchSuccess";

} catch (Exception e) {
e.printStackTrace();
return "to_searchError";
}

}
这种方法之前我在别的jsp页面中都使用过都好使,就是找个jsp页面传不出来,也找不到原因!!!

解决方案 »

  1.   

    HttpServletRequest request = ServletActionContext.getRequest();
    String page= request.getParameter("toId");试试看,在action里
      

  2.   

    <s:property value="toId"/> </td> 
    不会把值传回ACTION,你需要在页面中加入 一个hidden把toId放入.传回来的时候用hidden传回.
    <s:hidden name="toId" value="<s:property value='toId'/>"></s:hidden>
    大至是这样.
      

  3.   

    <s:param name="toId" value="%{toId}" />try againgoog luck :) 
      

  4.   

    传值的是这句 <s:url action="searchOneTo" id="url1">
      <s:param name="toId" value="toId" />
      </s:url>
          <td> <div align="center"> <a href=" <s:property value="#url1"/>" target="changeTo.jsp">修改 </a> </div> </td>
      

  5.   

     <s:param name="toId" value="toId" /> 
    改为 <s:param name="toId" value="${toId}" /> 
    试一试
      

  6.   

    <-- Example 1 -->
    <s:url value="editGadget.action">
        <s:param name="id" value="%{selected}" />//selected是Action实例中的一个属性(该属性存在值堆栈中, 用%{}取值)
    </s:url><-- Example 2 -->
    <s:url action="editGadget">
        <s:param name="id" value="%{selected}" />
    </s:url><-- Example 3-->
    <s:url includeParams="get">
        <s:param name="id" value="%{'22'}" />  //
    </s:url>