日期:2014-05-20  浏览次数:20672 次

springMVC与velocity实现一个简单的静态页面数据传送
package com.alipay.anymock.web.comp.editor;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.context.request.WebRequest;
@Controller
@RequestMapping("/cmpEditPage1.htm")
public class springMap {
  @RequestMapping(method=RequestMethod.GET)
  public String doget(ModelMap map,WebRequest request){
  /**
  * 把List集合当成Map值的对像来存值
  */  
  String modeString = request.getParameter("mode");//设置页面的参数值  
  Map<String, List<bool>> sMap=new HashMap<String, List<bool>>(); 
List<bool> oist=new ArrayList<bool>();
oist.add(0, new bool(1, "aaa"));
oist.add(1, new bool(2, "bbb"));
oist.add(2, new bool(3, "ccc"));  
 
List<bool> oist02=new ArrayList<bool>();
oist02.add(0, new bool(1, "aaa2"));
oist02.add(1, new bool(2, "bbb2"));
oist02.add(2, new bool(3, "ccc2"));  
 
sMap.put("oist", oist);
sMap.put("oist02", oist02);
 
map.addAttribute("mode", modeString);
 
map.addAttribute("maps", sMap);
 
return "cmpEditPage1.vm";
  }
  @RequestMapping(method=RequestMethod.POST)
  public String dopost(ModelMap map,WebRequest request){
   
  return "cmpSuccess.vm";
  }
   
}
里面不会写了。。。

------解决方案--------------------
会的话,给我说下。