java 控制器向页面传值方式

时间:2021-11-11 15:58:09

1.单个字符串 

@RequestMapping(value = "list", method = RequestMethod.GET)
public ModelAndView list(Integer investorApplyId) {
ModelAndView model = new ModelAndView(
"daybusiness/InvestorApplyDetail/list");
model.addObject("investorApplyId", investorApplyId);
return model;

}

这句 model.addObject("investorApplyId", investorApplyId);  是存接收到的值

前台页面 写法 : ${investorApplyId }

例子: 

<input type="hidden" style="float: left" value="${investorApplyId }" id="investorApplyId"
name="investorApplyId"></input>