我正在研究Spring MVC。对JSP的知识非常有限......
我的控制器:
public ModelAndView handleRequest(HttpServletRequest request) {
ModelAndView mv = new ModelAndView("investigate");
mv.addObject("model", Model);
return mv;
}
我的模特:
public class Model {
public String research = "research";
public String getResearch() {
return research;
}
public void setResearch(String research) {
this.research = research;
}
}
我的观点:
<button id="plotbtn" onclick = "myFunction(${model.research})">plot</button>
但它不起作用。你能指出如何纠正它吗?感谢
答案 0 :(得分:2)
试试这个:
<button id="plotbtn" onclick = "myFunction('${model.research}')">plot</button>