当前位置: 代码迷 >> Java相关 >> jsp无法获得struts2Action的返回值解决方法
  详细解决方案

jsp无法获得struts2Action的返回值解决方法

热度:2860   发布时间:2013-02-25 21:49:10.0
jsp无法获得struts2Action的返回值
我在在action里的方法定义一个list
List<Bug> pList=bd.selectPro();
ServletActionContext.getContext().put("selectPro",pList);
return "selectPro";

然后想在jsp遍历接收pList

<td>
  <s:if test="pList==null">
  <select> <option>无项目</option> </select>
  </s:if>
  <s:else>
  <select>
  <s:iterator value="pList" id="Bug"><option><s:property value="project"/></option>
  </s:iterator> 
  </select>
  </s:else>
</td>
怎么无法取得pList

------解决方案--------------------------------------------------------
建议LZ使用setter的方法替代ServletActionContext.getContext().put("selectPro",pList);
进行传值吧
------解决方案--------------------------------------------------------
你的List放在selectPro下面,你去找pList当然没有值啦
  相关解决方案