Home  >  Article  >  Java  >  How to use java framework

How to use java framework

little bottle
little bottleOriginal
2019-05-22 14:18:284751browse

The framework is also called a semi-finished product in development. It cannot provide everything for the entire WEB application. However, with the framework, we can focus on the development of business logic without having to worry about its technical implementation and some auxiliary businesses. logic. Let's take a look at the three major frameworks of Java and the usage of Java frameworks.

How to use java framework

Three major frameworks of Java: Struts Hibernate Spring (The three major frameworks of Java are mainly used for WEB applications.)

What Is it SSH integration?

(1) struts (presentation layer) Spring (business layer) Hibernate (persistence layer).

(2) Struts: It is a presentation layer framework, mainly used for page display, accepting requests and distributing requests; in the MVC framework, Struts belongs to the VC level, responsible for interface presentation and distribution of MVC relationships; view Use JSP, HTTP, etc.

(3) Spring: It is a business layer framework and an integrated framework that can well bond the presentation layer and persistence layer.

(4) Hibernate: It is a persistence framework that is responsible for operations with relational databases.

How to use java framework

How to use Spring framework?

Spring supports both programmatic transaction strategies and declarative transaction strategies, and most of them use declarative transaction strategies.

There are 4 types of declarative transaction strategies:

(1) Use TransactionProxyFactoryBean to generate transaction proxy configuration for Bean.

(2) Adopt Bean inheritance transaction proxy configuration method.

(3) Use BeanNameAutoProxyCreator to automatically generate a transaction proxy based on Bean Name. This is a way to configure a transaction proxy using Spring's AOP framework, which requires a certain understanding of Spring's AOP.

(4) Use DefaultAdvisorAutoProxyCreator to directly use Spring's AOP framework to configure the transaction proxy. The effect is very good, but the readability is not as good as the previous three.

How to use Struts framework?

1. Guide the package (unzip) struts2-blank.war.

2. Write Action classes and some configuration files.

How to use Hibernate framework?

Hibernate can automatically generate entity classes and mapping files through tables.

Establish a certain mapping between Java objects and relational databases to achieve direct access to Java objects (generally entity classes).

First download the packages required by hibernate, and then copy the packages in lib to the project.

At the same time, you can also use myeclipse to load the hibernate framework directly. Configuration file hibernate.cfg.xml

Related learning recommendations: java basic tutorial

The above is the detailed content of How to use java framework. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn