package org.converter;
import java.util.Map;
import org.apache.struts2.util.StrutsTypeConverter;
import org.model.Tel;
public class MyTypeConverter extends StrutsTypeConverter{
public Object convertFromString(Map arg0,String[] arg1,Class arg2){
Tel tel=new Tel();
String[] str=arg1[0].split("-");
tel.setSectionNo(str[0]);
tel.setTelNo(str[1]);
return tel;
}
public String convertToString(Map arg0,Object arg1){
Tel tel=(Tel)arg1;
return "["+tel.getSectionNo()+"-"+tel.getTelNo()+"]";
}
}
import java.util.Map;
import org.apache.struts2.util.StrutsTypeConverter;
import org.model.Tel;
public class MyTypeConverter extends StrutsTypeConverter{
public Object convertFromString(Map arg0,String[] arg1,Class arg2){
Tel tel=new Tel();
String[] str=arg1[0].split("-");
tel.setSectionNo(str[0]);
tel.setTelNo(str[1]);
return tel;
}
public String convertToString(Map arg0,Object arg1){
Tel tel=(Tel)arg1;
return "["+tel.getSectionNo()+"-"+tel.getTelNo()+"]";
}
}