1.1.1 Type converters in Struts2
Struts2 built-in common data types a variety of converters
Boolean and Boolean
Char and Character
int and Integer
Long and long
float and float
Double and Double
Date can receive the YYYY-MM-DD format string
An array can convert more than one parameter of the same name into an array
Collection supports saving data to a List or Map collection
1.1.2 Error in type conversion in STRUTS2:
1.NoSuchMethodException Exceptions:
The background requires an int type to enter ABC in the page.
* reported an exception: Nosuchmethodexception (no exception for this method.)
* Normal input setage (int age);
* Enter a abc:setage (String age);---no way
String--->date. But the format of date must be YYYY-MM-DD not the date in this format, and an error will be added: nosuchmethodexception
2. You need to configure an input logical view:
* <result name= "input" >/demo3/demo1.jsp</result>
* Use <s:fielderror/>---in the page to get error messages in the Fielderror area. The page needs to enter the relevant tablib .... Uri= '/struts-tags ' profix= ' s '
3. Display Chinese information:
* Create a property file with the same name as the action class under the package that contains the action class.
* Customeraction.properties
* The key value of the property file: Invalid.fieldvalue. property name = Error message
STRUTS2 type converter, type conversion error, and input view