Struts an open-source MVC implementation This paper introduces Struts, a Model - View - Controller implementation that uses Servlet and JavaServer Pages (JSP) technology. Pillar changes can help you control the Web project and promote specialization. Even if you never implement a system with Struts, you might get some ideas for your future servlet and JSP page implementation.39400
Model-View-Controller (MVC)
JSP tag to solve our part of the problem. We still have to verify, process control and update application state issues. This is the MVC comes in handy. MVC helps resolve some issues three types of problems and methods of single module:
Model
The model contains the core application functionality. State Model packaged applications. Sometimes it's only function is to contain state. It knew nothing about the view or controller.
View
This view provides representation of the model. It is the appearance of the application. Model-view access to read, but do not know makers. In addition, it knew nothing about the controller. It occurs when the view changes to the model should be notified.
Controller
The controller is responsive to user input. It creates and sets the model.
MVC Model 2
In the Web brought some unique challenges to software developers, most notably in the absence of state between client and server. This stateless behavior makes it difficult to change the model notify the view. When the web browser must be re-query the server to discover modification of the application state.
Another notable change is that the use of different techniques to achieve the model or controller. Of course, we can use Java (or PERL, C / C ++ or what ever) code to generate HTML. There are several disadvantages to this method:
1.Java programmers should develop services, not HTML.
2.The need to change the code to change the layout.The need to change the code to change the layout.
Customer service should be able to create pages to meet their specific needs.
3.The page designer isn't able to have direct involvement in page development.
4.HTML embedded into code is ugly.
For the Web, the classical form of MVC needs to be changed. Figure 4 shows the network adaptability MVC, also commonly known as MVC Model 2 or MVC 2.
Struts, an MVC 2 implementation
Struts is a set of class collaboration, servlet, and JSP tags, make a reusable MVC 2 design. This definition implies that Struts is a framework, not a library, but Struts also contains a separate frame work of a wide range of tag libraries and utility classes.
Struts overview
• Client browser
An HTTP request from the client browser creates an event. The Web container will respond with an HTTP response.
• Controller
The Controller receives the request from the browser, and makes the decision where to send the request. With Struts, the Controller is a command design pattern implemented as a servlet. The struts-config.xml file configures the Controller.
• Business logic
The business logic updates the state of the model and helps control the flow of the application. With Struts this is done with an Action class as a thin wrapper to the actual business logic.
• Model state
The model represents the state of the application. The business objects update the application state. ActionForm bean represents the Model state at a session or request level, and not at a persistent level. The JSP file reads information from the ActionForm bean using JSP tags.
• View
The view is simply a JSP file. There is no flow logic, no business logic, and no model information -- just tags. Tags are one of the things that make Struts unique compared to other frameworks like Velocity.
Struts pros
• Use of JSP tag mechanism
The tag feature promotes reusable code and abstracts Java code from the JSP file. This feature allows nice integration into JSP-based development tools that allow authoring with tags.
- 上一篇:Struts英文参考文献和中文翻译
- 下一篇:Linux上C的开发英文文献和中文翻译
-
-
-
-
-
-
-
g-C3N4光催化剂的制备和光催化性能研究
上市公司股权结构对经营绩效的影响研究
浅析中国古代宗法制度
中国传统元素在游戏角色...
现代简约美式风格在室内家装中的运用
巴金《激流三部曲》高觉新的悲剧命运
NFC协议物理层的软件实现+文献综述
C++最短路径算法研究和程序设计
江苏省某高中学生体质现状的调查研究
高警觉工作人群的元情绪...