1 jsp中用¥{paramterName}接受数据
${announce}
2 发送参数方式
①用ModelMap
@RequestMapping("/user/login/page.do")
public ModelAndView showLoginPage(ModelMap modelMap){
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("user_login");
modelMap.addAttribute("announce","tom");
return modelAndView;
}
②用HttpServiceRequest
@RequestMapping("/user/login/page.do")
public String showLoginPage(HttpServletRequest request){
request.setAttribute("announce","tom");
return "user_login";
}
③用ModelAndView
@RequestMapping("/user/login/page.do")
public ModelAndView showLoginPage(){
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("user_login");
modelAndView.addObject("announce","tom");
return modelAndView;
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)