struts2中的基础配置文件

来源:互联网 发布:腾讯代理吃鸡会优化吗 编辑:程序博客网 时间:2024/06/05 21:17

web.xml拦截器配置

  <filter>  <filter-name>struts2</filter-name>  <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>  </filter>  <filter-mapping>  <filter-name>struts2</filter-name>  <url-pattern>/*</url-pattern>  </filter-mapping>

struts.xml基础配置

<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE struts PUBLIC    "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN"    "http://struts.apache.org/dtds/struts-2.1.dtd"><struts>    <!-- struts.enable.DynamicMethodInvocation 默认值是true 开启动态调用方法-->    <constant name="struts.enable.DynamicMethodInvocation" value="true" />    <!-- true  开启开发者模式 -->    <constant name="struts.devMode" value="true" />    <!-- 页面的样式又开发者自己掌控 -->    <constant name="struts.ui.theme" value="simple"/>    <!-- 开发者修改请求的扩展名  可以处理.do  .action  默认  的请求-->    <constant name="struts.action.extension" value="action,,"/>    <package name="default" namespace="" extends="struts-default">        <default-action-ref name="requestError" />    <global-results>    <result name="error">/error.jsp</result>    </global-results>    <global-exception-mappings>    <exception-mapping result="error" exception="java.lang.Throwable">    </exception-mapping>    </global-exception-mappings>                <action name="requestError">            <result>/requestError.jsp</result>        </action>    </package></struts>


原创粉丝点击