首页 > 编程语言 > 详细

SpringMVC的view

时间:2016-09-06 19:55:52      阅读:210      评论:0      收藏:0      [点我收藏+]

@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页面上
}

SpringMVC的view

原文:http://www.cnblogs.com/rrtt/p/5846936.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!