Basic idea of JavaBean programming-logic business layer

Source: Internet
Author: User
JavaBean is a Java class used to implement the business logic layer.
What do you mean? I'll make it short: we know that JSP programming is to write Java code into an HTML file, and JavaBean programming is to write Java code in another Java class file, then we just need to call the Java file in the HTML file, of course, all the files are in a project. This is called JavaBean, which is the code for the business logic layer.
Here's an example of a simple idea of JavaBean programming: Implementing a Circle's area calculation and then displaying the results on the page.
First we write the Java code to be used in a Java class file, Java code can implement the definition of the class, variable definition, function definition, and so on functions

Here I simply define a circle radius and area function. As you can see, it's all Java code, without any HTML elements.
And then we just need to call it in the page, and there's a comment in the code.

Now our HTML page has no Java code, and the Java code we're going to execute is in another place. After the program runs, you will see that the area of the circle with radius 20 is displayed on our page.
To summarize: JavaBean programming is to separate the Java code from the HTML code, we see the client only HTML code, and we call the Java code is executed on the server side. Professional said JSP file implementation of user interface layer view, is the appearance of our page, that is, the Web front-end. And JavaBean implements the business logic layer model, which is called the Web backend. We often have a servlet programming, implementation of the control layer, this will give you a detailed explanation, I hope you can understand JavaBean programming a realization idea.

Basic idea of JavaBean programming-logic business layer

Related Article

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.