Struts2 struts.xml 常用配置信息

Struts2配置详解

<?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> <include file="struts-default.xml" /> <!-- 由.action改为.do --> <constant name="struts.action.extension" value="do" /> <!-- do或action --> <!-- <constant name="struts.action.extension" value="do,action" />--> <!-- truts2用来指定默认编码的--> <constant name="struts.i18n.encoding" value="UTF-8" /> <!-- 改变常量后不许重启服务器 ,系统默认为false--> <constant name="struts.configuration.xml.reload" value="true" /> <!-- 便于排错,打印出更详细的错误信息--> <constant name="struts.devMode" value="true" /> <!-- 使用动态方法调用前必须设置Struts2允许动态方法调用 --> <constant name="struts.enable.DynamicMethodInvocation" value="true" /> <!-- 设置浏览器是否缓存静态内容,默认为TRUE 开发阶段最好关闭--> <constant name="struts.server.static.browserCache" value="false" /> <!-- 默认的视图主题--> <constant name="struts.ui.theme" value="simple" /> <!-- 与spring集成时,指定spring负责action对象的创建--> <!-- <struts name="struts.objectFactory" value="spring" />--> <!-- 上传文件大小限制--> <!-- <struts name="struts.multipart.maxSize" value="10241024" />--> <package name="/" extends="struts-default"> <action name="login" class="com.alpha.action.LoginAction"> <result name="input">/login.jsp</result> <result name="error">/error.jsp</result> <result name="success">/main.jsp</result> </action> </package> <package name="login" extends="struts-default"> <interceptors> <interceptor name="checkLogin" class="com.alpha.action.interceptor.LoginInterceptor" /> <interceptor-stack name="mydefault"> <interceptor-ref name="checkLogin" /> <interceptor-ref name="defaultStack" /> </interceptor-stack> </interceptors> <default-interceptor-ref name="checkLogin" /> <global-results> <result name="login">/login.jsp</result> </global-results> <action name="login" class="com.alpha.action.LoginAction"> <result name="input">/login.jsp</result> <result name="error">/error.jsp</result> <result name="success">/main.jsp</result> <interceptor-ref name="checkLogin" /> </action> <action name="add" class="com.alpha.action.LoginAction"> <interceptor-ref name="checkLogin" /> <result name="success">/add.jsp</result> </action> <action name="show" class="com.alpha.action.LoginAction"> <interceptor-ref name="checkLogin" /> <result name="success">/show.jsp</result> </action> </package> </struts>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值