简体   繁体   中英

Java @Model Annotation, which library do I import to use it?

At this URL: Injecting JSP from Spring MVC controller

They have the following snippet of code:

@RequestMapping(value = "/widgets.html", method = RequestMethod.POST)
public ModelAndView widgets(@Model Fruit fruit, @RequestParam("texture") String texture)

My question, the @Model annotation, what library needs to be imported to make use of it?

Thank you in advance, Wes

I think it is the

import org.springframework.ui.Model;

Replace the @Model to @ModelAttribute Fruit fuit like grid answered.

And import org.springframework.web.bind.annotation.ModelAttribute;

Take a look here: http://docs.spring.io/spring/docs/current/spring-framework-reference/html/mvc.html

I think it is a typo of @ModelAttribute.

@Model is a class level annotation of J2EE 6 CDI

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM