//第二种转换器写法public class PointConvert2 extends StrutsTypeConverter{ @Override public Object convertFromString(Map context, String[] values, Class toClass) { // TODO Auto-generated method stub Point p = new Point(); String[] strs = (String[])values; String[] xy = strs[0].split(","); p.x = Integer.parseInt(xy[0]); p.y = Integer.parseInt(xy[1]); return p; } @Override public String convertToString(Map context, Object o) { // TODO Auto-generated method stub return o.toString(); } }
以point为例,复杂参数传递方式
list<point> ps: 参数传递?ps[0].x=1&ps[0].y=2&ps[1].x=11&ps[1].y=22
map<string,point> map: 参数传递?map[‘a‘]=1,2&map[‘b]=11,21
原文地址:https://www.cnblogs.com/Danial7777777/p/9153661.html
时间: 2024-11-12 18:27:16