现在的位置: 首页 > 综合 > 正文

struts-config.xml中元素的顺序

2013年01月23日 ⁄ 综合 ⁄ 共 793字 ⁄ 字号 评论关闭
struts-config.xml中的元素有严格的顺序,如果元素的顺序出错,系统会抛出一个错误,描述如下:
The content of element type "struts-config" must match "(display-name?,description?,data-sources?,form-beans?,global-exceptions?,global-forwards?,
action-mappings?,controller?,message-resources*,plug-in*)". [109]
刚看到这个错误,我总以为是某个元素的拼写出了错误,把整个文件仔细检查了一遍,没有发现任何拼写作错误。查了资料才知道,struts-config.xml中的元素有严格的顺序,他们的顺序应该是象下面这个样子:
<struts−config>
<data−sources>
<data−source>
</data−source>

</data−sources>
<form−beans>

<form−bean />

</form−beans>
<global−forwards>

<forward />

</global−forwards>
<action−mappings>

<action/>

</action−mappings>
<controller />
<message−resource />
<plug−in />

</struts−config>
上面的错误提示不是说元素有拼写错误,而是说struts-config.xml必须按照display-name-->description-->datasources-->form-beans-->global-forwards-->action-mappings-->controller-->message_resources-->plug-in的顺序书写。

 

抱歉!评论已关闭.