Struts uses a Model 2 architecture
来源:互联网 发布:java聊天程序源代码 编辑:程序博客网 时间:2024/04/20 01:29
Struts uses a Model 2 architecture. The Struts ActionServlet controls the navigational
flow. Another Struts class, the Action, is used to access the business classes.
When the ActionServlet receives a request from the container, it uses the URI (or
path”) to determine which Action it will use to handle the request. An Action can
validate input and access the business layer to retrieve information from databases
and other data services.
To validate input or use the input to update a database, the Action needs to
know what values were submitted. Rather than force each Action to pull these
values out of the request, the ActionServlet bundles the input into a JavaBean.
The input beans are subclasses of the Struts ActionForm class. The ActionServlet
can determine which ActionForm to use by looking at the path of the request, in
the same way the Action was selected. An ActionForm extends org.apache.
struts.action.ActionForm.
Each HTTP request must be answered with an HTTP response. Usually, a Struts
Action does not render the response itself but forwards the request on to another
resource, such as a JSP page. Struts provides an ActionForward class that can be
used to store the path to a page under a logical name. When it has completed the
business logic, the Action selects and returns an ActionForward to the servlet. The
servlet then uses the path stored in the ActionForward object to call the page and
complete the response.
Struts bundles these details together into an ActionMapping object. Each
ActionMapping is related to a specific path. When that path is requested, the servlet
retrieves the ActionMapping object. The mapping tells the servlet which
Actions, ActionForms, and ActionForwards to use.
All of these details, the Actions, ActionForms, ActionForwards, ActionMappings,
and some other things, are declared in the struts-config.xml file. The Action-
Servlet reads this file at startup and creates a database of configuration objects. At
runtime, Struts refers to the objects created with the configuration file, not the
file itself. Figure 1.1 illustrates how these components fit together.
Believe it or not, you already know enough about Struts to assemble a simple
application. It won’t do much, but it will illustrate how Struts actually works.
- Struts uses a Model 2 architecture
- 3.Struts 2 Architecture
- Struts 2 plugin architecture
- Struts 2 Architecture
- The Struts 2 Architecture
- Executable UML: A Foundation for Model-Driven Architecture
- Struts Architecture
- Model Driven Architecture
- Model Driven Architecture
- An Analytical Model for a GPU Architecture with Memory-level and Thread-level Parallelism Awareness
- cakephp model 不引入$uses 写法
- Struts的Model-2 MVC策略
- Struts如何实现Model 2, MVC
- The Model-View-Controller Architecture
- Classic network server architecture model
- 【转】The Architecture Twitter Uses To Deal With 150M Active Users, 300K QPS, A 22 MB/S Firehose, And Send Tweets In Under 5 Second
- error C2079: 'a' uses undefined class 'A' .
- A Swing Architecture Overview
- 为什么在网址里会出现乱七八糟的SessionId?(原创)
- 幸福的小女人
- 使用ATL库中的CImage类加载图片作为对话框背景
- 看一个英国人如何教育10岁的女儿
- 汉普残局
- Struts uses a Model 2 architecture
- ASP.NET如何读取客户端的真实IP地址(原创)
- Javascript 正则表达式测试页面
- 我的收藏夹
- 这个资料先保存一下
- 为什么Windows那么多以On开头的方法?(关于对继承中事件处理的认识!)
- 终于办完手续了,唉...
- FasSms2.0beta1整合Cnforums2.02(附源码版)
- XML入门