在此网址:Injecting JSP from Spring MVC controller
他们有以下代码片段:
@RequestMapping(value = "/widgets.html", method = RequestMethod.POST)
public ModelAndView widgets(@Model Fruit fruit, @RequestParam("texture") String texture)
我的问题,@Model注释,需要导入什么库才能使用它?
预先感谢您, 韦斯
最佳答案
我认为是
import org.springframework.ui.Model;
将@Model
替换为@ModelAttribute Fruit fuit
,就像网格回答一样。
并导入org.springframework.web.bind.annotation.ModelAttribute;
看这里:http://docs.spring.io/spring/docs/current/spring-framework-reference/html/mvc.html
关于Java @Model Annotation,我需要导入哪个库才能使用它?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26656769/