What exactly is JavaBean

JavaBean is actually a special Java class, a specification, and also a technology.

Compared with other Java classes, JavaBean must meet the following conditions:

  1. No-parameter construction method must be provided
  2. All attributes in the class must be privatized ( private)
  3. Needs to be serialized and implement Serializableinterfaces
  4. There may be a series setteror gettermethod

Sun introduced jspthe technology, but also recommends two web application development model, one is the jsp + javabeanmodel, one is the Servlet + jsp + javabeanmodel

  • The jsp + javabean mode is suitable for developing web applications with less complex business logic. In this mode, it is javabeanused to encapsulate business data, jspwhich is responsible for processing user requests and displaying data
  • **Servlet +jsp+javabean(MVC)** mode is suitable for developing complex web applications. In this mode, it servlet(Controler)is responsible for processing user requests, jsp(View)data display, and javabean (Model)data encapsulation.

In short, it javabeanis a specification language, a special Java class used to standardize, store, encapsulate, and preserve the database.

Guess you like

Origin blog.csdn.net/weixin_44471490/article/details/111658878