今天,刚刚在struts-config.xml中添加了个plug-in标签,百思不得其解的是文件会出现红叉叉,也就是文件编译不能通过了。于是乎,就百度了一下,竟然是标签顺序颠倒问题。这个问题以前一直没特别注意。

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd">
<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-resources / >
<plug-in />
</struts-config>

这是正确的struts-config.xml配置标签顺序。位置只要跟这里的不一样,就会编译不通过。