Patterns used in Java EE project development

Source: Internet
Author: User

One, Java EE traditional development adopted mode: MODEL1 mode

The most primitive Web program was written based on Java Servlet, and then the advent of JSP technology made it possible to effectively separate the html/xhtml document in the Web program from the Java Business logic code. In general, JSP is responsible for dynamically generating web pages, while business logic is implemented by other reusable components such as JavaBean. JSP can access these components through Java program fragments, so there is a jsp+javabean such a common program structure.

In this mode, JSP set control and display in one, this JSP-centric development model can quickly develop a lot of small Web projects.

One drawback: The code for JDBC access to the database is related to the DBMS, and when you replace the background database, you must override the JavaBean that accesses the data. and the data access code is written in accordance with the established, disconnected process, is process-oriented programming, which is incompatible with the entire Java EE Application object-oriented design style!

Second, Jsp+servlet+javabean (Model2 mode)

The Servlet receives a request from the browser,

The Servlet invokes the corresponding JavaBean according to different requests.

JavaBean operates the database according to its own business logic,

The Servlet passes the result to the JSP view,

The JSP renders the results of the background processing to the browser.

Although the MODEL2 model successfully overcomes the shortcomings of the Model1, it is at the cost of re-introducing the original Servlet programming. Exposing the Servlet API greatly increases the difficulty of programming, and in order to shield the complexity of the servlet API and reduce the workload of developing programs with the MODEL2 model, Struts 2 is invented.

Third, JSP+STRUTS2+JDBC

       

Patterns used in Java EE project development

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.