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的开发英文文献和中文翻译
-
-
-
-
-
-
当代大学生慈善意识研究+文献综述
河岸冲刷和泥沙淤积的监测国内外研究现状
java+mysql车辆管理系统的设计+源代码
杂拟谷盗体内共生菌沃尔...
大众媒体对公共政策制定的影响
乳业同业并购式全产业链...
十二层带中心支撑钢结构...
酸性水汽提装置总汽提塔设计+CAD图纸
电站锅炉暖风器设计任务书
中考体育项目与体育教学合理结合的研究