1. 程式人生 > >struts.xml配置詳解

struts.xml配置詳解

struts.xml是我們在開發中利用率最高的檔案,也是Struts2中最重要的配置檔案。

一下分別介紹一下幾個struts.xml中常用到的標籤

1、<include>

利用include標籤,可以將一個struts.xml配置檔案分割成多個配置檔案,然後在struts.xml中使用<include>標籤引入其他配置檔案。

比如一個網上購物程式,可以把使用者配置、商品配置、訂單配置分別放在3個配置檔案user.xml、goods.xml和order.xml中,然後在struts.xml中將這3個配置檔案引入:

struts.xml:

1 2 3 4 5 6 7 8 9 10 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" <struts> <include file="user.xml"/> <include file="goods.xml"/> <include file="order.xml"/> </struts>

user.xml:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" <struts> <package
 name="wwfy" extends="struts-default"> <action name="login" class="wwfy.user.LoginAction"> <!--省略Action其他配置--> </action> <action name="logout" class="wwfy.user.LogoutAction"> <!--省略Action其他配置--> </action> </package>

相關推薦

struts.xml配置(名稱空間、約束、動態代理)

1、package 元素: 1.1 作用:方便分模組化開發 1.2 屬性: name:必須有。唯一。標識一個包, 好有一定的含義。 extends:繼承。一般要求必須繼承struts-default的包。不繼承該包,將無法使用struts2提供的一些核心功能。stru

struts.xml配置

struts.xml是我們在開發中利用率最高的檔案,也是Struts2中最重要的配置檔案。 一下分別介紹一下幾個struts.xml中常用到的標籤 1、<include> 利用include標籤,可以將一個struts.xml配置檔案分割

struts1的配置檔案struts-config.xml配置

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "struts-co

setting.xml 配置

校驗 找不到 順序 裁剪 全局 -- mls leg 觸發 文件存放位置 全局配置: ${M2_HOME}/conf/settings.xml 用戶配置: ${user.home}/.m2/settings.xml note:用戶配置優先於全局配置。${user.home}

web.xml配置

知識 其他 location 參數 pin systems doctype doc clu web.xml配置詳解 引文: 對於一個J2EE領域的程序員而言,基本上每天都會和web應用打交道。 什麽是web應用?最簡單的web應用什麽樣?給你一個web應用你該從何入手

Web.xml配置之context-param

ltr 完成 數據庫 數據 鍵值對 art str htm 方法 轉自:http://blog.csdn.net/liaoxiaohua1981/article/details/6759206 格式定義: [html] view plaincopy

struts.properties配置

pro request location pri term i18n 臨時 def toolbox Struts 2框架有兩個核心配置文件,其中struts.xml文件主要負責管理應用中的Action映射,以及該Action包含的Result定義等。除此之 外,Struts

tomcat中server.xml配置

連接超時 兩個 數據大小 value soc 訪客 ace sed 器)   Tomcat Server的結構圖如下:該文件描述了如何啟動Tomcat Server。 <Server port="8005" shutdown="SHUTDOWN"> &

tomcat中server.xml配置(轉載)(一)

重要 lis 結構 更多 tle 處理請求 服務器端 sta 設置 轉載自:https://www.cnblogs.com/starhu/p/5599773.html tomcat中server.xml配置詳解 Tomcat Server的結構圖如下:(該文件描述了如何

tomcat中server.xml配置(轉載)(二)

lin power servlet容器 secure redirect tar 屬性 限制 man 轉載自:https://www.cnblogs.com/starhu/p/5599773.html 一:<Connector>元素 由Connector接口定義.

Java學習02-web.xml配置

log 用戶授權 相對 lte 聯合 page int config 定制 <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSche

Spring 入門 web.xml配置

.net .html tle spring tail pri .com http https Spring 入門 web.xml配置詳解 https://www.cnblogs.com/cczz_11/p/4363314.html https://blog.csdn.ne

深入淺出javaEE系列(一)---web.xml配置

web.xml是web專案最重要的一個檔案 一:定義頭和根元素 <?xml version="1.0" encoding="UTF-8"?>         部署描述符檔案就像所有xml檔案一樣,必須以一個xml頭開始。這個頭宣告必

maven的pom.xml配置

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.

Web.xml配置之context-param,listener

 格式定義: [html]  view plain copy <c

Web.XML 配置

每一個站的WEB-INF下都有一個web.xml的設定檔案,它提供了我們站臺的配置設定. web.xml定義: .站臺的名稱和說明 .針對環境引數(Context)做初始化工作 .Servlet的名稱和對映 .Session的設定 .Tag library的對映 .JSP網頁

java日誌處理元件log4j--log4j.xml配置

<?xml version="1.0" encoding="GBK" ?>     <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">     <log4j:configuration xmlns:log4j="http:/

java web工程web.xml配置

Web.xml詳解: 1.web.xml載入過程(步驟) 首先簡單講一下,web.xml的載入過程。當啟動一個WEB專案時,容器包括(JBoss、Tomcat等)首先會讀取專案web.xml配置檔案裡的配置,當這一步驟沒有出錯並且完成之後,專案才能正常地被啟動起來。

ActiveMQ.xml 配置

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> &l

Mybatis關聯查詢之一對多XML配置

但是有些地方沒有解釋詳細,自己研究了一會,決定將之詳細化 首先是有兩張表,頭行結構。相當於是一張老師表一張學生表。 邏輯結構就是一個老師有多個學生,我們在查詢的時候想要的結果是查出所有的老師的