1
回答
Struts2的global-exception-mappings问题,求解
华为云4核8G,高性能云服务器,免费试用   

各位大牛,我想用struts2定义所有的异常全部跳到统一的页面,配置如下

<package name="default" extends="struts-default">

        <interceptors>
            <interceptor name="exception" class="com.yzg.core.interceptors.ExceptionInterceptor"/>
            <interceptor name="log" class="com.yzg.core.interceptors.LogInterceptor"/>
            
            <interceptor-stack name="defaultInterceptors">
            	<interceptor-ref name="defaultStack">
            		<param name="exception.logEnabled">true</param>  
    				<param name="exception.logLevel">error</param>
            	</interceptor-ref>
                <interceptor-ref name="exception"/>
                <interceptor-ref name="log"/>
            </interceptor-stack>
        </interceptors>
        
        <default-interceptor-ref name="defaultInterceptors"/>
		<default-action-ref name="notFound"/>
        
    	<global-results>
			<result name="error" type="redirect">/error/500.jsp</result> 
		</global-results>
		<global-exception-mappings>
			<exception-mapping result="error" exception="java.lang.Exception"></exception-mapping> 
		</global-exception-mappings>
		
		<action name="notFound">
			<result>/error/404.jsp</result>
		</action>
		
    </package>
报错:org.xml.sax.SAXParseException: Element type "result" must be followed by either attribute specifications, ">" or "/>".

没加global-results和global-exception-mappings时是没问题的,求解哪错了 

<无标签>
举报
太子长琴
发帖于5年前 1回/1K+阅
顶部