`
chriszeng87
  • 浏览: 722322 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Struts2 in Action 读书笔记(一)

    博客分类:
  • Java
阅读更多

一些基础性的东西: 1. Struts 2 sits on top of two important technologies. At the heart of all Struts2 applications lie the client/server exchanges of the HTTP protocol. The Java Servlet API exposes these lowlevel HTTP communications to the Java language.Although it’s possible to write web applications by directly coding against the Servlet API, this is generally not considered a good practice. Basically, Struts 2 uses the Servlet API so that you don’t have to. But while it’s a good idea to keep the Servlet API out of your Struts 2 code, it seems cavalier to enter into Struts 2 development without some idea of the underlying technologies. The next two sections provide concise descriptions of the more relevant aspects of HTTP and Java Servlets.它们的关系见附件图1。

 

2.Struts等框架都用到了HTTP协议 Most web applications run on top of HTTP. This protocol is a stateless series of client/server message exchanges. Normally, the client is a web browser and the server is a web or application server. The client initiates communication by sending a request for a specific resource. The resource can be a static HTML document that exists on the server’s local file system, or it can be a dynamically generated document with untold complexity behind its creation. 看来有空真的要看看《TCP/IP详解》

 

3.很重要的一个问题,什么是框架? A framework is a piece of structural software. We say structural because structure is perhaps a larger goal of the framework than any specific functional requirement. A framework tries to make generalizations about the common tasks and workflow of a specific domain. The framework then attempts to provide a platform upon which applications of that domain can be more quickly built. The framework does this primarily in two ways. First, the framework tries to automate all the tedious tasks of the domain. Second, the framework tries to introduce an elegant architectural solution to the common workflow of the domain in question.

 

4.为什么要使用框架? First, new developers will always have to learn the framework(你自己开发的框架) from the ground up. If you’re using a mainstream framework,there’s a trained work force waiting for you to hire them. Second, the in-house framework is unlikely to see elegant revisions that keep up with the pace of industry.In-house frameworks seem to be subject to architectural erosion as the years pass, and too many extensions are inelegantly tacked on.

 

5.拦截器的概念 Interceptors are Struts 2 components that execute both before and after the rest of the request processing. They provide an architectural component in which to define various workflow and cross-cutting tasks so that they can be easily reused as well as separated from other architectural concerns.

 

6.ValueStack的概念 Struts 2 uses the ValueStack as a storage area for all application domain data that will be needed during the processing of a request. Data is moved to the ValueStack in preparation for request processing, it is manipulated there during action execution, and it is read from there when the results render their response pages.

 

7.OGNL的概念 OGNL is a powerful expression language (and more) that is used to reference and manipulate properties on the ValueStack. 8.Two mechanisms for declaring your architecture Through XML-based configuration files or through Java annotations.

<action name="Login" class="manning.Login">

<result>/AccountPage.jsp</result>

<result name="input">/Login.jsp</result>

</action>

<action name="Registration">

<result>/Registration.jsp</result>

</action>

<action name="Register" class="manning.Register">

<result>/RegistrationSuccess.jsp</result>

<result name="input">/Registration.jsp</result>

</action>

或者: @Results({ @Result(name="input", value="/RegistrationSuccess.jsp" ) @Result(value="/RegistrationSuccess.jsp" ) })

public class Login implements Action {

public String execute() {

//Business logic for login

}

}

 

我还是不会写读书笔记,感觉完全是书摘了.....

  • 大小: 14 KB
0
0
分享到:
评论

相关推荐

    Struts2_Action学习笔记、通配符{1},{2}

    Struts2_Action学习笔记、通配符{1},{2}......

    struts2 学习笔记 实战

    三、 Namespace Namespace决定了action的访问...是用来解决重名的问题,例如当系统的前台和后台都有一个action名叫hello,这时就需要用package来区分。 前台后台 struts2中的package与java的package是相同的作用的。

    struts2学习笔记

    struts2学习笔记,拦截器,action,所需jar包,从零开始

    Struts2 学习笔记

    01 Struts2-Action 5 一、 Struts作用: 5 二、 搭建Struts2的运行环境: 5 三、 Namespace 6 四、 标签 6 五、 Action 6 六、 路径问题的说明 8 七、 Action的动态调用方法 8 八、 Action通配符(wildcard)的配置 9 ...

    马士兵Struts2笔记2013

    建立一个Struts2 工程,用Action的属性接收参数,使用Domain Model (实体模型) 接收参数,Struts2_2.1.6版本的中文问题,Struts模块包含,Struts简单数据验证 ,Struts ValueStack(值栈) Debug,Value Stack ...

    SSH笔记-Spring整合Struts2

    SSH笔记-Spring整合Struts2,作用是使用 IOC 容器来管理 Struts2 的 Action

    Struts读书笔记.rar

    Struts 读书笔记,一小段内容摘抄: ...... Struts的ActionForm 对象是框架用来在用户和业务层之间来回传递数据的。框架会自动收集请求的输入,然后使用from bean 将数据传递给Action,最后再传递给业务层。 对于...

    struts2笔记之动态调用Action指定方法及默认Action

    详细讲解struts2中单个action中多个处理逻辑的配置方法, 以及默认Action的配置.

    我的笔记:Struts构架中action的跳转大全

    我的笔记:Struts构架中action的跳转大全

    struts项目学习笔记

    Struts2 是一个非常优秀的MVC框架,基于Model2 设计模型 由传统Struts1和WebWork两个经典框架发展而来 Struts2框架=Struts2+XWork Strust2 核心功能 允许POJO(Plain Old Java Objects,简单javabean对象,没有继承,...

    struts2学习笔记!

    struts2学习笔记!因为还没有全部学完,所以分部分分享!主要内容:struts.xml配置,web.xml配置 Action要点!全局类型转换,部分类型转换,类型转换文件 类型装换错误的处理问题局部使用,把中文汉字转换为编码 struts2对...

    Struts课堂笔记.rar--struts2的struts.properties配置文件详解

    struts.action.extension The URL extension to use to determine if the request is meant for a Struts action 用URL扩展名来确定是否这个请求是被用作Struts action,其实也就是设置 action的后缀,例如login....

    struts学习笔记

    建立一个Java Web项目,提取最少运行Struts2应用的包集合,目标:实现一个简单的用户登录 包括内容: 一、先实现登录页面 二、实现处理页面的Action 三、配置Web.xml 四、配置Action处理结果和资源资源之间的映射关系 ...

    struts学习笔记(2)

    当前struts2的filter过滤到一个.action结尾的请求的时候,会把这个请求交给struts2内部的拦截器(interceptor) 2)拦截器起到什么作用 可以帮我们丰富action的功能,比自动类型转换(页面传一个String类型的id,接收的...

    Struts1.3 备忘笔记

    Struts 1.3 备忘笔记 【资源特点】 1、以项目形式组织,包含所有的源代码 2、内含详细的注释说明 3、知识点较全面 【内容目录】 01 Struts_01HandworkApply : 手工配置Struct应用程序,演示用户提交数据后服务器的...

    struts2学习笔记 很基础 容易懂

    struts2学习笔记 很基础 容易懂第一个struts2的web用户登录工程:创建一个web工程-&gt;创建login.jsp(创建advanced的JSP)-&gt;登录的form表单(注意:action=“login.action”)-&gt;编写完成后配置

    struts 2 笔记 struts2 基础

    action 的一些基础操作 的学习过程

    Struts高级部分(2)(常用Action、验证框架、动态Form)笔记

    Struts高级部分(2)(常用Action、验证框架、动态Form)笔记Struts高级部分(2)(常用Action、验证框架、动态Form)笔记

    Struts2 + Hibernate开发笔记(二).txt

    当要从Action中执行的loadCity方法,要返回到jsp页面时,要在页面上指定一个return的页面.我们在admin-action.xml配置中可以看到一句 &lt;result name="city"&gt;/admin/city.jsp 而在loadCity方法中有这样一句 return "city...

    struts2学习笔记,总结了很多学习的经验

    struts2学习笔记,总结了很多学习的经验,标签的使用,action的使用。struts2.0 和 struts2.1 的区别

Global site tag (gtag.js) - Google Analytics