Things to note after combining Model and Bean


  • After integration, the data in the JSP template output Bean will depend on its getter method. The output variable name is the getter method. After removing the "get" prefix character, the first letter of the remaining characters will be lowercase. If you want JSP still uses the previous output method. You can call ModelRecordElResolver when the system starts. setResolveBeanAsModel(true);
  • #getModel() in Controller requires the form field name to correspond to the data table field name, and getBean() relies on the setter method. The form domain name corresponds to the setter method. After removing the "set" prefix character, the remaining string letters become lowercase.
  • Many third-party tools similar to jackson and fastjson rely on the getter method of Bean to operate, so jackson and fastjson can only be used after integration
  • JFinalJson will Model When converting to json data, the keyName of json is the original data table field name, while the keyName of json converted by jackson and fastjson that rely on the getter method is the camel case name converted from the data table field name
  • It is recommended that the field names of the mysql data table be named in camel case directly, so that the keyName of json can be completely consistent, and the JSP can also use completely consistent attribute names when getting values ​​in the page. Note: The names of mysql data tables still use underscore naming and lowercase letters to facilitate portability between Linux and Windows systems.
  • In short, when using the combined Bean, you must know whether to use the getter and setter methods in its BaseModel or the get(String attrName) method in its Model