1. 程式人生 > >struts-config.xml 文件:

struts-config.xml 文件:

alias inf void 聯系 section err nac nocache 文件的

struts-config.xml配置文件是一個在Web客戶端組件的視圖和模型之間的聯系,但你的項目的99.99就不會碰這些設置%。基本的配置文件包含以下主要內容:

SNInterceptor & 描述
1 struts-config
This is the root node of the configuration file.
2 form-beans
This is where you map your ActionForm subclass to a name. You use this name as an alias for your ActionForm throughout the rest of the struts-config.xml file, and even on your JSP pages.
3 global forwards
This section maps a page on your webapp to a name. You can use this name to refer to the actual page. This avoids hardcoding URLs on your web pages.
4 action-mappings
This is where you declare form handlers and they are also known as action mappings.
5 controller
This section configures Struts internals and rarely used in practical situations.
6 plug-in
This section tells Struts where to find your properties files, which contain prompts and error messages

下面是示例struts-config.xml文件:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd">

<struts-config>

   <!-- ========== Form Bean Definitions ============ -->
   <form-beans>
      <form-bean name="login" type="test.struts.LoginForm" />
   </form-beans>

   <!-- ========== Global Forward Definitions ========= -->
   <global-forwards>
   </global-forwards>

   <!-- ========== Action Mapping Definitions ======== -->
   <action-mappings>
      <action
         path="/login"
         type="test.struts.LoginAction" >

         <forward name="valid" path="/jsp/MainMenu.jsp" />
         <forward name="invalid" path="/jsp/LoginView.jsp" />
      </action>
   </action-mappings>

   <!-- ========== Controller Definitions ======== -->
   <controller 
      contentType="text/html;charset=UTF-8"
      debug="3"
      maxFileSize="1.618M"
      locale="true"
      nocache="true"/>

</struts-config>

struts-config.xml文件的更多詳細信息,請檢查你的Struts文檔。

struts-config.xml 文件: