<body>
   <s:action name="userList" executeResult="true"></s:action>     <table border="1" cellpadding="0" cellspacing="0">
<s:iterator value="#request.ulist">
    <tr>
    <td width="100"><s:property value="%{id}"/></td>
    <td width="200"><s:property value="%{name}"/></td>
    <td width="200"><s:property value="%{pass}"/></td>
    </tr>
</s:iterator>
    </table>
<br/>
  </body>页面代码
public String select() {
try {
List<Userss> userList = biz.userList();
this.setUlist(userList);
return SUCCESS;
} catch (Exception e) {
e.printStackTrace();
return INPUT;
}
}action代码
<action name="userList" class="userAction" method="select">
<result name="success">/index.jsp</result>
</action>action配置
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>web.xml文件
在index.jsp页面中直接请求action  在本页处理返回的数据。 打印时出现了循环的情况,循环了N次。

解决方案 »

  1.   

    <s:action name="userList" executeResult="false"></s:action>
      

  2.   

    页面请求Action,Action又转到页面,页面再次请求Action....轮回呐~~
      

  3.   

    二楼说的对,action之后跳到页面后又再次请求action,这样就出现循环了
      

  4.   

    我想要的结果是 action返回的数据在本页处理。  该怎么实现?
      

  5.   

    那就是直接访问这个Action,然后转到这个页面上来处理啊...不是在页面里访问Action
      

  6.   

    我想这样访问  http://localhost:8080/工程名称/    就直接跳到一个jsp页面显示出数据。请问我能像servlet 那样 直接在web.xml中 直接配置某一个servlet就能跳到servlet中查询数据跳转到页面显示吗?就是因为struts2不能这样配置。 而是需要一个中间页面  写个javascript当中间页面加载的时候就请求action  然后才是查询数据 跳转到index.jsp页面中显示数据。 所有我才看了s:action  资料说能在当前页面处理数据。我就拿来试试。 没想到就循环了。
      

  7.   

    你的这个要求都很普遍,就是首页进入的是一个Action,而不是一般的页面.
      

  8.   

    声明欢迎页为Action,创建一个空的XXX.action文件.看看这样的解决办法