Before you talk about model-driven, take a look at attribute-driven, attribute-driven, and models that are used to resolve the value of a form and the values of a property in a class.
One, attribute driven
A) Principle: mainly depends on the Parameterinterceptor interceptor to achieve the form value and action in the corresponding properties of the value transfer, Valuestack.setvalue () method operation value Stack.
b) Form:
I. Set properties in action that have the same name as the Name property in the page form and must have set and get methods.
Ii. Note: If the attribute-driven and model-driven property names are duplicated, only the model driver can fetch the value, and the property-driven value is null.
c) schematic diagram:
A) Example:
I. JSP pages are as follows:
The action is as follows:
First, model driven
A if there's a lot of content in the JSP page form, attribute-driven action classes need to write many attributes and corresponding sets and get methods that affect the readability of the main processes in the action, so that the corresponding attributes of the form are placed in a specialized javabean to form an entity class.
b) Model driven
I.action class:
Entity classes: