struts2 的action 会执行两次

新星_star 新星_star 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
小弟在做网站的时候遇到action会被执行两次的情况,在网上找了资料,也没能解决。
首先我在index的页面写了一个链接

<a href="Employees/EmployeesPage">123</a>

这个页面跳转到EmployeesPage这个action
代码如下

<action name="EmployeesPage" class="com.lsxy.action.EmployeesAction" method="go">
<result name="addPage">/EmployeesAddPage.jsp</result>
</action>

method go的方法如下:

public String go() {
QsCtypeDao ctypeDao = new QsCtypeDao();
ctype = ctypeDao.findAll();
System.out.println("123");
return "addPage";
}

输出的时候 控制台有2个123 并有警告。

123
2011-6-19 11:31:02 com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
警告: No configuration found for the specified action: '/Employees/EmployeesAdd' in namespace: '/Employees'. Form action defaulting to 'action' attribute's literal value.
2011-6-19 11:31:02 com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
警告: No configuration found for the specified action: '/Employees/EmployeesAdd' in namespace: '/Employees'. Form action defaulting to 'action' attribute's literal value.
2011-6-19 11:31:02 com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
警告: No configuration found for the specified action: '/Employees/EmployeesAdd' in namespace: '/Employees'. Form action defaulting to 'action' attribute's literal value.
2011-6-19 11:31:02 com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
警告: No configuration found for the specified action: '/Employees/EmployeesAdd' in namespace: '/Employees'. Form action defaulting to 'action' attribute's literal value.
123

各位大大有没有遇到过类似的情况?如何解决呢?

...全文

相关推荐

评论 15
收藏 已收藏
分享
返回顶部
新星_star
Web 开发 81,108 成员 341,721 内容