Java Bean and Servlet in JSP

Source: Internet
Author: User

In the past, I was not familiar with JAVA Development. I always thought that the JavaBean and Servlet are amazing, strange, and complicated. Now I have read a very basic JSP book, I have finally understood them.

JavaBean can be said to be a JAVA class, except that it has getXXX) and setXXX) methods. It is similar to get/set in. NET, or it must be a public class with a non-argument constructor. In JSP development, it can be said to process some logic, such as computing, and the JSP page uses <jsp: useBean...> this label references this JavaBean class and displays the processing result and some information on the JSP page. It can be said that the background and foreground are basically separated.

Servlet is not specifically developed for HTTP, but it seems that it is only used here. It mainly applies the HttpServlet class. DoGet ()/doPut ()/doPost ()... Wait for the doXXX method, and there is a service) method. These functions have only two parameters, one of which is HttpServletRequest and HttpServletResponse, reques is generated when the web server responds to the http request of the browser and closes the request information in HttpServletRequest. It also creates an HttpServletResponse object and provides the Servlet with the response information.

The service method has been implemented in HttpServlet. It is to call different doXXX methods based on different HTTP requests. At the same time, we do not directly call doXXX) methods, generally, we only need to override the doXXX) method. Then, HttpServlet will automatically call the service) method and use the service () method to call the doXXX) method. In programming, we mainly cover the doGet and dePut methods.

The most important thing here is that the web server encapsulates the client request information to HttpServletRequest and creates HttpServletResponse. Then we can get the corresponding request information and output the corresponding response.

  1. Implement JSP page and code separation using JavaBean
  2. Analysis of Application in JSP program
  3. JavaBean tasks and design considerations
  4. Seven Tips for improving JSP page response speed
  5. JavaBeans, EJB, and POJO

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.