昨天晚上碰到一个问题,如下:
今天早上起来,终于弄明白了。
下面说说原因:
问题出在了 struts-config-role.xml 与 struts-config-user.xml 中
struts-config-role.xml
<struts-config>
<!-- ================================================ Form Bean Definitions -->
<form-beans>
<!-- "RoleForm" action -->
<form-bean name="roleForm"
type="com.nana.web.struts.forms.RoleForm">
</form-bean>
</form-beans>
<!-- =========================================== Action Mapping Definitions -->
<action-mappings>
<!-- "UpdateRole" action -->
<action path=" /role/updateRole"
type="com.nana.web.struts.actions.UpdateRoleAction"
scope="request"
name="roleForm"
attribute="roleForm"
validate="true"
input="/role/updateRole.jsp">
<forward name="SUCCESS" path="/role/result/updateRole_success.jsp"></forward>
</action>
</action-mappings>
</struts-config>
struts-config-user.xml
<struts-config>
<!-- ================================================ Form Bean Definitions -->
<form-beans>
<!-- "UserForm" action -->
<form-bean name="userForm"
type="com.nana.web.struts.forms.UserForm">
</form-bean>
</form-beans>
<!-- =========================================== Action Mapping Definitions -->
<action-mappings>
<!-- "UpdateRole" action -->
<action path="role/updateRole"
type="com.nana.web.struts.actions.UpdateUserAction"
scope="request"
name="userForm"
attribute="userForm"
validate="true"
input="/user/updateUser.jsp">
<forward name="SUCCESS" path="/user/result/updateUser_success.jsp"></forward>
</action>
</action-mappings>
原来是两个path属性的值完全相同了,那么前边配置的那个就不会生效,也就是说,当客户端的请求路径是 /role/updateRole.do 的时候,只会是匹配 com.nana.web.struts.actions.UpdateUserAction 的实例,这对于 User模块 来说不会有任何问题(歪打正着),但对于 Role模块 来说就麻烦了,
此时UserForm 被错误地指定给了它(本来应该有自己的RoleForm),所以产生了一开头时图片上的异常。
也是,action 标签的 path属性本来就应该是唯一的,这是最基本的,无论是不是分了模块,写下来记录一下。。。
- 大小: 78.5 KB
分享到:
相关推荐
struts1多模块多配置文件的开发流畅图解
struts2配置文件以及代码示例struts2配置文件以及代码示例struts2配置文件以及代码示例struts2配置文件以及代码示例struts2配置文件以及代码示例struts2配置文件以及代码示例struts2配置文件以及代码示例struts2配置...
struts.xml配置文件详解struts.xml配置文件详解struts.xml配置文件详解
·Struts2配置文件介绍 struts.xml action package ·Struts2配置文件介绍 struts.xml action package
struts配置文件,用于创建springmvc与struts工程的配置文件,集合加数组获得后台的空间空间空间 空间 空间空了
Struts应用的配置 多应用模块的配置 Struts配置文件 多应用模块的划分有助于应用的并行开发,提高效率
struts2开发的struts.xml配置文件配置以及web.xml配置说明
大型项目的struts,spring配置文件
struts2核心配置文件,struts2.xml和struts2.properties
详解struts1的配置文件.doc
Struts的一般配置文件Struts的一般配置文件Struts的一般配置文件Struts的一般配置文件Struts的一般配置文件
Struts应用采用两个基于XML配置文件来配置,分别是web.xml和struts-cofig.xml文件.web.xml文件 是配置所有web应用而struts-config.xml文件是struts专用配置文件,事实上也是可以根据需要给这个配置文件 起其他名称.
配置SSH框架时关于Struts2的配置文件
Struts2的配置文件的详细说明,写的好不错!
多个struts配置文件使用,如何配置??
关于struts2等需要的配置文件 struts配置的文件 连接池 mysql等配置文件
关于MyEclipse对Struts2配置文件较检异常 Invalid result location valueparamete
struts2如何配置找到 struts下的提示信息
struts多模块开发,struts多模块开发,struts多模块开发,struts多模块开发,struts多模块开发,struts多模块开发,struts多模块开发,struts多模块开发,struts多模块开发,struts多模块开发,struts多模块开发,struts多模块...