struts1.3中<struts-config>报错
来源:互联网 发布:mac推出磁盘快捷键 编辑:程序博客网 时间:2024/06/13 11:19
struts1.3中<struts-config>报错
一个项目中struts-config.xml文件老是报错
在<struts-config>的标签中报错:
The content of element type "struts-config" must match "(display-name?,description?,form-beans?,global-exceptions?,global-forwards?,action-
mappings?,controller?,message-resources*,plug-in*)".
显然,是我的文件中标签的不匹配造成的,但是我找了一圈,发现标签的使用都很正常。该xml文件如下:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN" "http://struts.apache.org/dtds/struts-config_1_3.dtd">
<struts-config>
<form-beans>
<form-bean name="employeeForm" type="com.hsp.web.forms.EmployeeForm" />
</form-beans>
<action-mappings>
<action path="/login" parameter="flag" name="employeeForm">
<forward name="ok" path="WEB-INF/MainFrame.jsp"></forward>
</action>
<!-- 配置employeeaction -->
<action path="/employee" name="employeeForm" parameter="flag">
<forward name="goAdd" path="/WEB-INF/addEmpUi.jsp" />
<forward name="goList" path="/WEB-INF/listEmp.jsp"/>
<forward name="goUp" path="/WEB-INF/updEmpUi.jsp"/>
</action>
</action-mappings>
<!-- 配置全局跳转 -->
<global-forwards>
<forward name="opererr" path="/WEB-INF/err.jsp" />
<forward name="operok" path="/WEB-INF/welcome.jsp" />
</global-forwards>
<controller>
<set-property property="processorClass" value="org.springframework.web.struts.DelegatingRequestProcessor"/>
</controller>
</struts-config>
上面的action已经被spring代理了,所以没有配置type属性
我试着去掉一些标签,发现是<action-mappings>标签的问题(去掉该标签后没有报错了),我们知道,“?”是代表该标签只能出现零次或一次,“*”代表是零次或多次,在这个xml文件中也就出现了一次,但是也没理由报错,而且标签都是一一匹配的。在网上找了好久,才发现这是个比较隐蔽的错误,就是各个成员的顺序错误也会报错的。把<action-mappings>整体往下移动,移动到<global-forwards>的后面就没报错了。-_-
如下:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN" "http://struts.apache.org/dtds/struts-config_1_3.dtd">
<struts-config>
<form-beans>
<form-bean name="employeeForm" type="com.hsp.web.forms.EmployeeForm" />
</form-beans>
<!-- 配置全局跳转 -->
<global-forwards>
<forward name="opererr" path="/WEB-INF/err.jsp" />
<forward name="operok" path="/WEB-INF/welcome.jsp" />
</global-forwards>
<action-mappings>
<action path="/login" parameter="flag" name="employeeForm">
<forward name="ok" path="WEB-INF/MainFrame.jsp"></forward>
</action>
<!-- 配置employeeaction -->
<action path="/employee" name="employeeForm" parameter="flag">
<forward name="goAdd" path="/WEB-INF/addEmpUi.jsp" />
<forward name="goList" path="/WEB-INF/listEmp.jsp"/>
<forward name="goUp" path="/WEB-INF/updEmpUi.jsp"/>
</action>
</action-mappings>
<controller>
<set-property property="processorClass" value="org.springframework.web.struts.DelegatingRequestProcessor"/>
</controller>
</struts-config>
一个项目中struts-config.xml文件老是报错
在<struts-config>的标签中报错:
The content of element type "struts-config" must match "(display-name?,description?,form-beans?,global-exceptions?,global-forwards?,action-
mappings?,controller?,message-resources*,plug-in*)".
显然,是我的文件中标签的不匹配造成的,但是我找了一圈,发现标签的使用都很正常。该xml文件如下:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN" "http://struts.apache.org/dtds/struts-config_1_3.dtd">
<struts-config>
<form-beans>
<form-bean name="employeeForm" type="com.hsp.web.forms.EmployeeForm" />
</form-beans>
<action-mappings>
<action path="/login" parameter="flag" name="employeeForm">
<forward name="ok" path="WEB-INF/MainFrame.jsp"></forward>
</action>
<!-- 配置employeeaction -->
<action path="/employee" name="employeeForm" parameter="flag">
<forward name="goAdd" path="/WEB-INF/addEmpUi.jsp" />
<forward name="goList" path="/WEB-INF/listEmp.jsp"/>
<forward name="goUp" path="/WEB-INF/updEmpUi.jsp"/>
</action>
</action-mappings>
<!-- 配置全局跳转 -->
<global-forwards>
<forward name="opererr" path="/WEB-INF/err.jsp" />
<forward name="operok" path="/WEB-INF/welcome.jsp" />
</global-forwards>
<controller>
<set-property property="processorClass" value="org.springframework.web.struts.DelegatingRequestProcessor"/>
</controller>
</struts-config>
上面的action已经被spring代理了,所以没有配置type属性
我试着去掉一些标签,发现是<action-mappings>标签的问题(去掉该标签后没有报错了),我们知道,“?”是代表该标签只能出现零次或一次,“*”代表是零次或多次,在这个xml文件中也就出现了一次,但是也没理由报错,而且标签都是一一匹配的。在网上找了好久,才发现这是个比较隐蔽的错误,就是各个成员的顺序错误也会报错的。把<action-mappings>整体往下移动,移动到<global-forwards>的后面就没报错了。-_-
如下:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN" "http://struts.apache.org/dtds/struts-config_1_3.dtd">
<struts-config>
<form-beans>
<form-bean name="employeeForm" type="com.hsp.web.forms.EmployeeForm" />
</form-beans>
<!-- 配置全局跳转 -->
<global-forwards>
<forward name="opererr" path="/WEB-INF/err.jsp" />
<forward name="operok" path="/WEB-INF/welcome.jsp" />
</global-forwards>
<action-mappings>
<action path="/login" parameter="flag" name="employeeForm">
<forward name="ok" path="WEB-INF/MainFrame.jsp"></forward>
</action>
<!-- 配置employeeaction -->
<action path="/employee" name="employeeForm" parameter="flag">
<forward name="goAdd" path="/WEB-INF/addEmpUi.jsp" />
<forward name="goList" path="/WEB-INF/listEmp.jsp"/>
<forward name="goUp" path="/WEB-INF/updEmpUi.jsp"/>
</action>
</action-mappings>
<controller>
<set-property property="processorClass" value="org.springframework.web.struts.DelegatingRequestProcessor"/>
</controller>
</struts-config>
0 0
- struts1.3中<struts-config>报错
- hibernate3和struts1整合的时候struts-config.xml报错
- (struts1)struts-config.xml
- struts1 中struts-config.xml的path原理
- Struts1中web.xml和struts-config.xml的配置
- 【Struts1.2总结】struts-config.xml配置
- 【Struts1.2总结】struts-config.xml配置
- 【Struts1.2总结】struts-config.xml配置
- struts1的数据库配置struts-config.xml
- 【STRUTS1.2】struts-config.xml详解
- Struts1的 struts-config.xml说明
- Struts1.2总结 struts-config.xml配置
- 【Struts1.2】struts-config.xml配置详解
- 【Struts1.2总结】struts-config.xml配置
- struts1.x struts-config.xml配置详解
- 详解Struts1中的struts-config.xml配置文件
- struts1.x struts-config.xml配置详解
- 【Struts1.2总结】struts-config.xml配置
- 猫猫学IOS(十四)UI之UITableView扩充_表格的修改_(增删移动)
- C# 值类型和引用类型
- Python2.x和3.x主要差异总结
- 用struct模块实现python socket收发自定义TCP包
- java延时设置
- struts1.3中<struts-config>报错
- linux下mysql的卸载过程
- 【Python笔记】剖析Python的切片(slicing)语法
- 白盒测试的工具CPPtest使用
- 每个程序员都应该了解的十一句话
- 指定eclipse启动使用jdk
- CSS关于字体大小的简单换算(em px)
- eclipse导入Android项目经常会出现的问题---来自王阳
- L-BFGS算法