小弟在做网站的时候遇到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各位大大有没有遇到过类似的情况?如何解决呢?
首先我在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各位大大有没有遇到过类似的情况?如何解决呢?
<a href="EmployeesPage">123</a>
因哦你下面有警告
No configuration found for the specified action: '/Employees/EmployeesAdd' in namespace: '/Employees'. Form action defaulting to 'action' attribute's literal value.
说在命名空间找不到这个action
<a href="Employees/EmployeesPage">123</a>这里href指向的Action没找到(因为你的XML配置的只是EmployeesPage action把它改成<a href="EmployeesPage.action">123</a>
找不到资源。=<a href="Employees/EmployeesPage">123</a>
应该改为
<a href="EmployeesPage">123</a>
如果是,并且用了firebug的话,会有这问题,当然,不是所有版本,官方有bug报告偿试把firebug关掉试试