struts2 的action 会执行两次
小弟在做网站的时候遇到action会被执行两次的情况,在网上找了资料,也没能解决。
首先我在index的页面写了一个链接
这个页面跳转到EmployeesPage这个action
代码如下
method go的方法如下:
输出的时候 控制台有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
各位大大有没有遇到过类似的情况?如何解决呢?
首先我在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
各位大大有没有遇到过类似的情况?如何解决呢?
...全文
相关推荐
Struts2防止重复提交解决方案
在Struts2中,我们可以利用`token`拦截器来实现这一功能。`token`拦截器会在Action执行前检查`token`,并在执行后清除`token`。
struts2中result类型之redirectAction
在Struts2中,Result是Action执行后控制流程的重要组件,它定义了Action执行完毕后如何转发或重定向到一个新的页面。"
测试struts2中action
执行完成后,Action会返回一个结果,这个结果通常指向一个视图页面,如JSP或Freemarker模板等。### 代码解析:测试Struts2中的Action#### 1.
Struts2之Action详解2
**拦截器(Interceptor)** Struts2中的拦截器是AOP(面向切面编程)的一种实现,可以在Action执行前后插入自定义逻辑。
struts2.0之action
相较于Struts 1.x,Struts 2.0的Action模型有着显著的区别。


Web 开发
