//Action控制類:OgnlTypeConvert
package cn
import com
public class OgnlTypeConvert extends ActionSupport
{
private User user ;
public User getUser()
{
return user;
}
public void setUser(User user)
{
this
}
public String execute()
{
if(this
this
{
return SUCCESS ;
}
else
{
return ERROR ;
}
}
}
//類型轉換核心類
package cn
import java
import ognl
public class TypeConversion extends DefaultTypeConverter
{
@Override
public Object convertValue(Map context
{
if(toClass == User
{
String strUser[] = (String[])values ;
String userInfo[] = strUser[
User user = new User() ;
user
user
return user ;
}
[
From:http://tw.wingwit.com/Article/program/Java/ky/201311/29167.html