JavaBean is actually a special Java class, a specification, and also a technology.
Compared with other Java classes, JavaBean must meet the following conditions:
- No-parameter construction method must be provided
- All attributes in the class must be privatized (
private
) - Needs to be serialized and implement
Serializable
interfaces - There may be a series
setter
orgetter
method
Sun introduced jsp
the technology, but also recommends two web application development model, one is the jsp + javabean
model, one is the Servlet + jsp + javabean
model
- The jsp + javabean mode is suitable for developing web applications with less complex business logic. In this mode, it is
javabean
used to encapsulate business data,jsp
which 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, andjavabean (Model)
data encapsulation.
In short, it javabean
is a specification language, a special Java class used to standardize, store, encapsulate, and preserve the database.