/**
 * 把字符串解析成日期格式
 * @param temp 格式为:2009-05-12 11:30 解析成 0905121130形式
 * @return yyyy-mm-dd hh:mi
 */
public String getTime(String temp){

StringBuffer result = new StringBuffer();
if(temp!=null&&!temp.equals("")){
result.append(temp.substring(2,4));
result.append(temp.substring(5,7));
result.append(temp.substring(8,10));
result.append(temp.substring(11,13));
result.append(temp.substring(14,temp.length()));
}
return result.toString();
}
 /* 计算字符串str中,symbol中出现在次数
 * @param str
 * @param symbol
 */
public int caculateSymbolQuantity(String str,String symbol){
String temp= str;
int i=0,n=0;//n存储符号出现的次数
i = temp.indexOf(symbol);
while(i!=-1){
temp=temp.substring(i+1,temp.length());
n++;
i = temp.indexOf(symbol);
}
return n;
}
public List getPlace(String place){
List result = new ArrayList();
String temp = "";
if(place!=null&&!place.equals("")){
int i = place.lastIndexOf(",");
if(i!=place.length()-1){//如果最后一位不是","号,则以","结尾
temp=place+",";
}else{
temp=place;
}
int n = caculateSymbolQuantity(temp,",");//计算该字符串中出现的","的个数
System.out.println("-------------n is :"+n);
int count = n/3;
String[] temps = place.split(",");
for(int j = 1; j <= count;j++){
result.add(temps[j*3-3]+","+temps[j*3-2]+","+temps[j*3-1]);//存的数据形式为:333,444,555
System.out.println(temps[j*3-3]+","+temps[j*3-2]+","+temps[j*3-1]);
}

}//if
return result;
}

public String save(){
///////////从前台获取的place的值是:95302,0,2009-09-18 10:51,01002,0,2009-09-25 10:52,01002,0,2009-09-03 10:52,
String place = request.getParameter("subName");
String ways = request.getParameter("subNameW");
//cr.setPlace(place);
cr.setRoute_way(ways); String way [] = ways.split(","); //这里就是所有的值了 
List l =getPlace(place);
Iterator it = l.iterator();
while(it.hasNext()){
String str_place = (String)it.next();

String[] places = str_place.split(",");
cr.setArea_name(places[0]); //接货地点编码
cr.setTakeOver_style(places[1]); //接货地点方式,市内还是市外
cr.setStop_time(getTime(places[2])); //停靠时间
cr.setPlace(places[0]+","+places[1]+","+getTime(places[2]));
System.out.println(places);
System.out.println("000000000000000000 place:"+places[0]+","+places[1]+","+places[2]);
}//if
carRouteService.saveData(cr);
return "close";
} 我最后想存到数据库里的应该是:95302,0,0909181051,01002,0,0909251052,01002,0,0909031052
可是照我这样的存法只能存一组如(01002,0,0909031052
).. 闷请高手指点下怎么能都存进去 谢谢