Home | 簡體中文 | 繁體中文 | 雜文 | 打賞(Donations) | ITEYE 博客 | OSChina 博客 | Facebook | Linkedin | 知乎專欄 | Search | Email

第 11 章 Apache Struts

目錄

11.1. struts.xml
11.1.1. include
11.2. Struts Tags
11.2.1. property
11.2.2. set
11.2.3. url
11.2.4. s:include
11.2.5. s:action
11.2.6. HTML Form
11.2.6.1. form
11.2.6.2. textfield
11.2.6.3. s:hidden
11.2.6.4. select
11.2.7. iterator
11.2.8. if elseif else
11.3. Action
11.3.1. redirect
11.3.2. redirectAction
11.3.3. JSON
11.3.3.1. enableGZIP 壓縮傳輸
11.3.3.2. excludeProperties 排除 Properties
11.3.3.3.
11.3.4. 傳遞 Timestamp 變數
11.4. Ajax + JSON
11.4.1. GET/POST JSON
11.5. Json 內容展示
11.5.1. 禁止方法
11.5.2. 格式化日期
11.5.3. 重命名變數名
11.5.4. org.apache.struts2.json
11.6. Interceptor
11.6.1. Session
11.7. Action 中使用綫程
11.8. 日誌
11.9. FAQ
11.9.1. Struts 怎樣判斷用戶來自電腦還是移動設備

http://struts.apache.org/

You can checkout all the example applications from the Struts 2 GitHub repository at https://github.com/apache/struts-examples.

11.1. struts.xml

web.xml

		
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns="http://java.sun.com/xml/ns/javaee"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
	id="WebApp_ID" version="3.0">
	<display-name>helloworld</display-name>
	<welcome-file-list>
		<welcome-file>index.html</welcome-file>
		<welcome-file>index.htm</welcome-file>
		<welcome-file>index.jsp</welcome-file>
		<welcome-file>default.html</welcome-file>
		<welcome-file>default.htm</welcome-file>
		<welcome-file>default.jsp</welcome-file>
	</welcome-file-list>

	<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>

</web-app>		
		
		

11.1.1. include

			
	<include file="/cn/netkiller/struts/ajax.xml" />
	<include file="/cn/netkiller/struts/admin.xml" />	
	<include file="/cn/netkiller/struts/logs.xml" />