[ 2222 ]http://e.eqxiu.com/s/wJMf15Ku
2015-12-23 19:48
597 查看
实例处理流程图
客户端 -请求-》 Struts2过滤器 StrutsPrepareAndExcuteFilter
-转发-》Action对象first
-返回-》视图first.jsp
Struts类库介绍
struts2-core-xxx.jar -- Struts2的核心类库
xwork-core-xxx.jar -- Xwork的核心类库
ognl-xxx.jar -- Ognl(Object Graph Navigation Language)表达式语言类库
commons-logging-xxx.jar -- Log4j日志支持类库
freemarker-xxx.jar -- Freemarker模板语言支持类库
commons-io-xxx.jar -- 处理IO操作的工具类库
commons-fileupload-xxx.jar -- 文件上传支持类库
Struts2的结构体系图
web.xml
struts.xml
index.jsp
first.jsp
index.jsp页面
first.jsp 页面
客户端 -请求-》 Struts2过滤器 StrutsPrepareAndExcuteFilter
-转发-》Action对象first
-返回-》视图first.jsp
Struts类库介绍
struts2-core-xxx.jar -- Struts2的核心类库
xwork-core-xxx.jar -- Xwork的核心类库
ognl-xxx.jar -- Ognl(Object Graph Navigation Language)表达式语言类库
commons-logging-xxx.jar -- Log4j日志支持类库
freemarker-xxx.jar -- Freemarker模板语言支持类库
commons-io-xxx.jar -- 处理IO操作的工具类库
commons-fileupload-xxx.jar -- 文件上传支持类库
Struts2的结构体系图
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" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>8.1</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> <!-- Struts2过滤器 --> <filter> <!-- 过滤器名称 --> <filter-name>struts2</filter-name> <!-- 过滤器类 --> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class> </filter> <!-- Struts2过滤器映射 --> <filter-mapping> <!-- 过滤器名称 --> <filter-name>struts2</filter-name> <!-- 过滤器映射 --> <url-pattern>/*</url-pattern> </filter-mapping> </web-app>
struts.xml
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd"> <struts> <!-- 声明包 --> <package name="myPackage" extends="struts-default"> <!-- 定义action --> <action name="first"> <!-- 定义处理成功后的映射页面 --> <result>/first.jsp</result> </action> </package> </struts>
index.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>主页</title> </head> <body> <a href="first.action">请求Struts2</a> </body> </html>
first.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>第一个Struts2程序</title> </head> <body> 第一个Struts2程序! <br> </body> </html>
index.jsp页面
first.jsp 页面
相关文章推荐
- 和前司运维(张松)谈网络
- 使用自定义的item、Adapter和AsyncTask、第三方开源框架PullToRefresh联合使用实现自定义的下拉列表(从网络加载图片显示在item中的ImageView)
- ASIHTTPRequest简介
- ASIHTTPRequest运用
- IOS开发网络篇之──ASIHTTPRequest下载示例(支持断点续传)
- KJHttp的基础功能和工作原理
- 面试总结8--计算机网络相关问题Part2
- iOS 获取网络状态
- android4.0 HttpClient 以后不能在主线程发起网络请求
- java最简单的方式实现httpget和httppost请求
- 卷积神经网络基础
- 网络编程之IO复用:select or epoll
- jquery sortable的拖动方法内容说明和示例详解(转载http://www.jb51.net/article/45803.htm)
- jquery sortable的拖动方法内容说明和示例详解(转载http://www.jb51.net/article/45803.htm)
- TCP和UDP的区别有哪些?
- ASIHTTPRequest 上传文件无响应问题研究
- ASIHTTPRequest 上传文件无响应问题研究
- 批处理、分时、实时、网络、分布式操作系统的区别
- libnids中TCP/IP栈实现细节分析(上)——TCP会话重组
- Quartz实现动态定时任务--http://my.oschina.net/u/1177710/blog/284608