Struts2 type conversion: (for the conversion between HTTP Request Parameters and Java strong types, you only need to name the HTTP parameter as a valid ognl expression, you can make full use of the struts2 type conversion mechanism.
If an unknown exception occurs during type conversion, struts2's conversionerror interceptor will automatically handle the exception and generate a prompt on the page)
Built-in type converter: (struts2 has built a built-in character string and a conversion converter between the following types)
> Boolean and Boolean
> Char and character
> Inthe and integer
> Long and long
> Float and float
> Double and double
> Date (the date format uses the short format of the local location where the user request is located)
> Array (by default, the array element is a string. If you provide a custom type converter, it is also an array of other composite types)
(Each element is converted separately based on the element type, but if the type of the array element itself cannot be converted, a type conversion error will occur)
> Set (by default, it is assumed that the element type of the set is string and a new arraylist is created to encapsulate all strings)
Ognl-based type conversion: (struts2 allows another simple method to convert request parameters to composite types)
Public class user {private string name; private string pass; // The setter and getter methods of the name and pass attributes ...} public class loginaction implements action {private user; // setter and getter methods of user public string execute () throws exception {...}}