The respective roles of SSH, the three major frameworks of JAVA

1. Spring

Spring is a powerful framework that solves many common problems in J2EE development. Spring provides a consistent approach to managing business objects and encourages the injection of good habits of programming to interfaces rather than classes. Spring's architectural foundation is based on the Inversion of Control container using JavaBean properties. However, this is only part of the complete picture: Spring is unique in using the IoC container as a complete solution that focuses on all architectural layers. Spring provides the only data access abstraction, including a simple and efficient JDBC framework, which greatly improves efficiency and reduces possible errors. Spring's data access architecture also integrates with Hibernate and other O/R mapping solutions. Spring also provides the only transaction management abstraction that provides a consistent programming model across various underlying transaction management technologies such as JTA or JDBC transactions. Spring provides an AOP framework written in the standard Java language, which provides declarative transaction management and other enterprise transactions for POJOs -- if you need them -- as well as implementing your own aspects. This framework is powerful enough to allow applications to throw away the complexities of EJBs while enjoying the key services associated with traditional EJBs. Spring also provides a powerful and flexible MVC web framework that can be integrated with the IoC container.

2. STRUCTS

Struts is an MVC framework based on the Sun J2EE platform, mainly using Servlet and JSP technology to achieve. Since Struts can fully meet the needs of application development, it is easy to use, agile and fast, and it has attracted much attention in the past year. Struts integrates Servlet, JSP, custom tags and message resources into a unified framework. When developers use it for development, they no longer need to code and implement a full set of MVC patterns, which greatly saves time. Therefore, Struts Is a very good application framework.

3. Hibernate

Hibernate is an open source object-relational mapping framework, which encapsulates JDBC with very lightweight objects, so that Java programmers can use object programming thinking to manipulate the database at will. Hibernate can be used in any occasion using JDBC, it can be used in Java client programs, and it can also be used in Servlet/JSP Web applications. The most revolutionary thing is that Hibernate can replace CMP in the J2EE architecture that uses EJB. , to complete the task of data persistence. , Hibernate can replace CMP in the J2EE architecture of the application EJB, complete the heavy task of data persistence. The mapping is very simple, it is the mapping of the page, you can do it with a little more practice,

The three major frameworks of JAVA are used to make WEN applications. Struts is mainly responsible for the display of the presentation layer. Spring uses its IOC and AOP to handle the control business (responsible for the operation of the database). Hibernate is mainly responsible for the persistence of data to the database. When using jsp servlet for web page development, there is a web.xml There is a mapping tag in the mapping file, which is used for file mapping. When you enter the URL address on the browser, the file will correspond to a java file according to the name you wrote, and the content written in the java file will be displayed on the browser, which is a web page, so the name of the web page is written casually. , whatever name you choose, no matter if you start .php .jsp .do or anything else, it corresponds to this java file, the code in this java file will do whatever operation it does, display a sentence or connect to the database or jump to other Pages, etc. This java file encapsulates the data for security and ease of management. In fact, this java file is compiled as a bytecode file of .class, and there is no web page file similar to html embedded tags and codes. The difference between him and the jsp file is that the jsp embeds the code in the html tag. There is also a servlet or struts in the html form action in the submission name corresponds to a java file, struts is generally .do, are the same as the above mapping.

 

 

今天导师又来找谈话,问项目做得怎么样了。这个月事情真的很多,之前研究生的啦啦操比赛,后来还有那么多课要结,全都要写作业。所以这个月根本就没动手。还有一个更重要的原因是,这项目做得实在无趣,没一个拿得出手的技术,全用的最简单的语句,这样一个代码怎么拿得出手,所以在学三大框架,可是跟老师一聊,发现学得确实有些茫目,所以上网查一下自己所学的东西到底是做什么的,能不能对自己的项目有所突破。

原文: http://christhb.blog.163.com/blog/static/98982492011727114936239/

-----------------------------------------------------------------------------------------------

SSH三者作用

  • Struts在项目中的作用

Struts 在项目主要起控制作用,只要用于web层(即视图层和控制层)
Struts本身是使用典型的MVC结构实现的,项目中使用了struts之后就等于项目也是一个MVC结构,使项目结构更清晰,分工更明细。
Struts在项目中主要负责视图层、控制层,在视图层提供了大量的标签库,提高视图层的开发速度。在控制层使用中央控制器(Actionsupport)和配置文件(struts.xml),实现拦截用户请求、封装请求参数及页面导航。

  • Spring在项目中的作用

Spring是一个全方位的整合框架,在项目中对hibernate和struts进行整合,解决层与层之间的耦合问题。
Spring的作用贯穿了整个中间层,将Web层、Service层、DAO层及PO无缝整合。
Spring的IoC来实现组件之间的依赖关系注入,上层框架不会渗透到下层组件,提高组件移植性和重用性,使得程序更灵活,上层框架不依赖实现而是依赖于抽象(委托接口)、使得实现类的变化不会影响上层组件,解决了层与层之间的藕合带来的维护或升级困难
SpringAOP 是面向方面编程,实现事务处理、日志服务等与业务无关的系统服务,实现插件式编程。

  • Hibernate在项目中的作用

Hibernate应用于数据持久化层,是对JDBC的轻量级封装。是一种对象、关系的映射工具, 提供了从 Java类到数据表的映射,也提供了数据查询和恢复等机制, 大大减少数据访问的复杂度。把对数据库的直接操作 , 转换为对持久对象的操作。
在项目中的主要作用就是1、解决程序与数据库的依赖,即使用了Hibernate之后,以后更改数据库不需要更改代码,因为Hibernate会根据数据库方言来生成对应的SQL语句;2、是对JDBC的轻量级封装,简化持久层的代码,提高开发速度。

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326562769&siteId=291194637