当前位置: 代码迷 >> Java Web开发 >> struts.xml配置的代码,哪位高手能帮忙分析一下
  详细解决方案

struts.xml配置的代码,哪位高手能帮忙分析一下

热度:295   发布时间:2016-04-17 01:16:10.0
struts.xml配置的代码,谁能帮忙分析一下
XML code
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE struts PUBLIC    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"    "http://struts.apache.org/dtds/struts-2.0.dtd"><struts>    <constant name="struts.devMode" value="true" />    <constant name="struts.objectFactory" value="spring" />        <package name="common" extends="struts-default">        <global-results>            <result name="error">/common/miplatform_error.jsp</result>        </global-results>            <global-exception-mappings>            <exception-mapping exception="java.lang.Exception" result="error"/>        </global-exception-mappings>    </package>



这些代码是什么作用?


------解决方案--------------------
struts.devMode
Whether Struts is in development mode or not
是否为struts开发模式

struts.objectFactory
The com.opensymphony.xwork2.ObjectFactory implementation class
com.opensymphony.xwork2.ObjectFactory接口(spring)
事务用spring


<package name="common" extends="struts-default">
<global-results>
<result name="error">/common/miplatform_error.jsp</result>
</global-results>
<global-exception-mappings>
<exception-mapping exception="java.lang.Exception" result="error"/>
</global-exception-mappings>
</package>
配置当程序报java.lang.Exception错误的时候跳转到
common/miplatform_error.jsp


>_<

------解决方案--------------------
XML code
<package name="common" extends="struts-default">         <global-results>             <result name="error">/common/miplatform_error.jsp </result>         </global-results>            <global-exception-mappings>             <exception-mapping exception="java.lang.Exception" result="error"/>         </global-exception-mappings>     </package>
  相关解决方案