Struts web.xml中常见配置

80酷酷网    80kuku.com

  web|xml

配置actionservlet的初始化路径

 <servlet>
    <servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
    <init-param>
      <param-name>debug</param-name>
      <param-value>3</param-value>
    </init-param>
    <init-param>
      <param-name>detail</param-name>
      <param-value>3</param-value>
    </init-param>
    <init-param>
      <param-name>config/moduleb</param-name>
      <param-value>/WEB-INF/struts-config-moduleb.xml</param-value>
    </init-param>
    <load-on-startup>0</load-on-startup>
   
 </servlet>
 <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
 </servlet-mapping>
配置过滤器的初始化路径:
   <filter>
     <filter-name>Set Character Encoding</filter-name>
     <filter-class>filter.SetCharacterEncodingFilter</filter-class>
     <init-param>
      <param-name>encoding</param-name>
         <param-value>UTF-8</param-value>
      </init-param>
   </filter>
   <filter-mapping>
     <filter-name>Set Character Encoding</filter-name>
     <url-pattern>/*</url-pattern>
   </filter-mapping>
配置欢迎界面:
    <welcome-file-list>
 <welcome-file>welcome.jsp</welcome-file>
   <welcome-file>welcome.jsp</welcome-file>
 </welcome-file-list>
配置404错误界面:
 <error-page>
 <error-code>404</error-code>
   <location>/404.jsp</location>
 </error-page>
配置500错误界面:
   <error-page>
     <error-code>500</error-code>
     <location>/500.jsp</location>
 </error-page>
配置ServletException错误界面:
 <error-page>
<exception-type>javax.servlet.ServletException</exception-type>
<location>/systemError.jsp</location>
</error-page>



分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: