webwork配置项的顺序问题

在 xwork.xml 中配置 interceptor 时,由于配置项位置的关系得到以下错误:

WebWork Problem Report
WebWork has detected an unhandled exception:

Messages: The content of element type "package" must match "(result-types?,interceptors?,default-interceptor-ref?,default-action-ref?,global-results?,global-exception-mappings?,action*)". 
File: file:/M:/Working%20Folder/Nan/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Nan/WEB-INF/classes/xwork.xml
Line number: 26
Column number: 15

配置文件为:

<! DOCTYPE xwork PUBLIC "-//OpenSymphony Group//XWork 1.1.1//EN" "http://www.opensymphony.com/xwork/xwork-1.1.1.dtd" >

< xwork >
    
< include  file ="webwork-default.xml" />

    
< package  name ="default"  extends ="webwork-default" >
    
        
        
< interceptors >
            
< interceptor  name ="DBManager"  class ="com.lingsmm.common.utils.ConnectionManageInterceptor" />
            
            
< interceptor-stack  name ="myDefault" >
                
< interceptor-ref  name ="params" />
                
< interceptor-ref  name ="DBManager" />
            
</ interceptor-stack >
        
</ interceptors >
        
< default-action-ref  name ="home"   />
        
< default-interceptor-ref  name ="myDefault" />

        
<!--  Add your actions here  -->
        
< action  name ="history"  class ="com.lingsmm.action.history.HistoryAction" >
            
< result  name ="input" > /WEB-INF/pages/historyEdit.jsp </ result >
            
< result  name ="login" > /WEB-INF/pages/login.jsp </ result >
            
< result > /WEB-INF/pages/home.jsp </ result >
        
</ action >
    
</ package >
</ xwork >

在 eclipse 中编辑时,会有语法错误提示,猜想这应该是在 DTD 文件中定义的,但对 DTD 不是很熟悉,没有作进一步分析.
解决的方法是,将 default-action-ref default-interceptor-ref 位置互换即可,所以认为是文档对项目节点的位置有强制要求.

你可能感兴趣的:(eclipse,exception,Interceptor,File,Webwork,action)