标签:
@RequestMapping("/person/{name}/{age}")
@ResponseBody //如果只是输出内容,则要加上这个,否则就会要hello.jsp
public String toPerson(@PathVariable String name,@PathVariable double age){
System.out.println(name+" "+age);
return "hello";
}
@RequestMapping(value = "/viewCar")
public String viewCar(Model model)
{
Car car = new Car();
car.setBrand("auto");
car.setPrice(100.00);
model.addAttribute(car);
return "/index/index"; //将car输出到model中,会输出index/index页面上
}
标签:
原文地址:http://www.cnblogs.com/rrtt/p/5846936.html