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

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当然没有值啦