1 public class UserConvert extends StrutsTypeConverter { 2 @Override 3 public Object convertFromString(Map map, String[] strings, Class aClass) { 4 User user = new User(); 5 String[] vals = strings[0].split(","); 6 user.setName(vals[0]); 7 user.setPwd(vals[1]); 8 return user; 9 } 10 11 @Override 12 public String convertToString(Map map, Object o) { 13 User user = (User) o; 14 return "name" + user.getName() + ",pwd" + user.getPwd(); 15 } 16 17 }