当前位置:编程学习 > JAVA >>

struts2 后台同一个action 被调用两次

public String getTopFunction() throws Exception {
中间代码省略 。。。
return SUCCESS;
}
struts.xml配置文件如下
<action name="getlogin" method="show"  class="com.nec_univergelive.ocms.login.action.LoginAction">
<result name="success" type="redirect">topaction</result>
<result name="iserror">/WEB-INF/jsp/login/Login.jsp</result>
</action>

<action name="topaction" method="getTopFunction"  class="com.nec_univergelive.ocms.top.action.TopAction">
<result name="success">/WEB-INF/jsp/top/Top.jsp</result>
</action>
getTopFunction方法被调用了两次 可能是什么原因导致的 --------------------编程问答-------------------- 原来 把方法明改了就OK了  初始化的时候把这方法当作get  set方法先调用一次  然后执行的时候再调用一次      - -  --------------------编程问答-------------------- 啥意思呢?
我今天也碰到了这样的问题,

谢谢。

<action name="findByUserIdBy" class="competitionsAction"
method="findByUserId">
<result name="success">/web/competitions/competition.jsp
</result>
<result name="input">/web/competitions/deleteError.jsp</result>
</action>


<a href="competitions/findByUserIdBy.action" target="main">赛事管理</a>

这一条连接,后台执行了两次,打印出了两条一样的Sql 语句~谢谢~
引用 1 楼  的回复:
原来 把方法明改了就OK了 初始化的时候把这方法当作get set方法先调用一次 然后执行的时候再调用一次 - -
--------------------编程问答-------------------- 看楼主代码 还以为是ACTION 的chain 调用呢
补充:Java ,  Eclipse
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,