WebMVC
Mario Arias edited this page Feb 22, 2016
·
12 revisions
This module add map-like support for ModelAndView
So you could write this code:
@RequestMapping(value = "/owners/*/pets/{petId}/visits", method = RequestMethod.GET)
public ModelAndView showVisits(@PathVariable int petId) {
ModelAndView mav = new ModelAndView("visitList");
mav.addObject("visits", this.clinicService.findPetById(petId).getVisits());
return mav;
}
In this way:
import org.kotlinprimavera.web.servlet.*
@RequestMapping(value = arrayOf("/owners/*/pets/{petId}/visits"), method = arrayOf(RequestMethod.GET))
fun showVisits(@PathVariable petId: Int): ModelAndView {
val mav = ModelAndView("visitList")
mav["visits"] = clinicService.findPetById(petId).visits
return mav
}
To use this module in your project
<dependency>
<groupId>org.kotlinprimavera</groupId>
<artifactId>webmvc</artifactId>
<version>0.5</version>
</dependency>