告诉你一个真实的Struts2--(注:太注重细节的看不懂)
2009-02-14 13:42
369 查看
Struts2相对Struts1来说,简化了不少。
主要表现在以下两个方面:
1、Stuts2的API完全屏蔽了Servlet的复杂性,开发人员无需知道Servlet就可实现业务功能。
2、Struts2缺少了Struts1里的ActionForm, 它将这部分整合进了Action。降低了对开发人员的要求。
但是呢,要使用Struts2做出可维护性比较高的系统,要求开发人员对Java的面向对象具备比较深的理解。
另外,Struts2引入了拦截器这个概念。在英文文档里(Apache Struts 2 Documentation Interceptors)它是这样描述的:
Interceptors can execute code before and after an Action is invoked. Most of the framework's core functionality is implemented as Interceptors. Features like double-submit guards, type conversion, object population, validation, file upload, page preparation, and more, are all implemented with the help of Interceptors. Each and every Interceptor is pluggable, so you can decide exactly which features an Action needs to support.
Interceptors can be configured on a per-action basis. Your own custom Interceptors can be mixed-and-matched with the Interceptors bundled with the framework. Interceptors "set the stage" for the Action classes, doing much of the "heavy lifting" before the Action executes.
从上面的文档看出,拦截器并没有实际明确的概念定义。依据本人的理解,拦截器是这样的:
1、首先是Struts2里定义的一个应用接口。
2、其次,拦截器其实就是web规范里的Filter。只不过Struts2对其进行了高层抽象封装。
根据本人最近开发项目的经验,Struts2其实和Struts1是一样的。理由如下:
1、从软件的延续性方面出发,Apache开发组织在某种程度上沿袭了Struts1的设计原理。因为为了鼓励Struts1的用户继续使用Struts2。
2、另外从技术层面来说,Struts2和Struts1在很大程度上具有对应性。
ActionSupport ---> Action
Action里的数据模型--->ActionForm
Struts.xml --->Struts-config.xml
3、最核心的对应都是基于一个配置文件定义处理结果和页面的跳转关系,来完成整个业务系统的功能。
但是,要想做好Struts2的高级开发,必须了解Struts2的核心内容。这些包括:
1、OGNL
2、ActionStack
3、Interceptor
鄙人用了不到两星期学会Struts2,并且设计了一套基础类。然后用了两天时间来优化Displaytag的多翻页处理问题。包含拦截器。
主要表现在以下两个方面:
1、Stuts2的API完全屏蔽了Servlet的复杂性,开发人员无需知道Servlet就可实现业务功能。
2、Struts2缺少了Struts1里的ActionForm, 它将这部分整合进了Action。降低了对开发人员的要求。
但是呢,要使用Struts2做出可维护性比较高的系统,要求开发人员对Java的面向对象具备比较深的理解。
另外,Struts2引入了拦截器这个概念。在英文文档里(Apache Struts 2 Documentation Interceptors)它是这样描述的:
Interceptors can execute code before and after an Action is invoked. Most of the framework's core functionality is implemented as Interceptors. Features like double-submit guards, type conversion, object population, validation, file upload, page preparation, and more, are all implemented with the help of Interceptors. Each and every Interceptor is pluggable, so you can decide exactly which features an Action needs to support.
Interceptors can be configured on a per-action basis. Your own custom Interceptors can be mixed-and-matched with the Interceptors bundled with the framework. Interceptors "set the stage" for the Action classes, doing much of the "heavy lifting" before the Action executes.
从上面的文档看出,拦截器并没有实际明确的概念定义。依据本人的理解,拦截器是这样的:
1、首先是Struts2里定义的一个应用接口。
2、其次,拦截器其实就是web规范里的Filter。只不过Struts2对其进行了高层抽象封装。
根据本人最近开发项目的经验,Struts2其实和Struts1是一样的。理由如下:
1、从软件的延续性方面出发,Apache开发组织在某种程度上沿袭了Struts1的设计原理。因为为了鼓励Struts1的用户继续使用Struts2。
2、另外从技术层面来说,Struts2和Struts1在很大程度上具有对应性。
ActionSupport ---> Action
Action里的数据模型--->ActionForm
Struts.xml --->Struts-config.xml
3、最核心的对应都是基于一个配置文件定义处理结果和页面的跳转关系,来完成整个业务系统的功能。
但是,要想做好Struts2的高级开发,必须了解Struts2的核心内容。这些包括:
1、OGNL
2、ActionStack
3、Interceptor
鄙人用了不到两星期学会Struts2,并且设计了一套基础类。然后用了两天时间来优化Displaytag的多翻页处理问题。包含拦截器。
相关文章推荐
- 告诉你一个真实的袁世凯
- struts2中用OGNL表达式定义字符串常量与单个字符常量需要注意的一个小细节
- 告诉你一个真实的北京
- 【zz】亲历华尔街--告诉你一个真实的美国财富传奇
- 告诉你一个真实的中国互联网:精英与草根
- 搜索引擎专家:告诉你一个真实的Android
- 告诉你一个真实的中国互联网:精英与草根
- 陈天桥语录:告诉你一个真实的首富
- 告诉你一个真实的中国互联网:精英与草根
- 1 开发一个注重性能的JDBC应用程序不是一件容易的事. 当你的代码运行很慢的时候JDBC驱动程序并不会抛出异常告诉你。 本系列的性能提示将为改善JDBC应用程序的性能介绍一些基本的指导原则,这其中的原则已经被许多现有的JDBC应用程序编译运行并验证过。 这些指导原则包括: 正确的使用数据库MetaData方法 只获取需要的数据 选用最佳性能的功能 管理连
- 告诉你一个真实的北京
- 告诉你一个真实的美国
- 告诉你一个真实的 OpenStack:都谁在用,用来干什么?
- 告诉你一个真实的中国互联网:精英与草根
- 告诉你一个真实的Google
- 揭开日本车的遮羞布,告诉你一个真实的日本车
- 『震惊』告诉你一个真实的上海薪水概念!!!
- 力荐!告诉你一个真实的中国互联网:精英与草根
- 告诉你一个真实的中国互联网:精英与草根
- 细节.告诉你一个你也许忘记了的细节