In Spring WebMVC 2.5 / 3, you can do all this with annotations. The obvious drawback is that, of course, the annotation values ββmust be a compile-time constant, so you can get some effectively hard-coded URLs. If you go all-in with auto-preparation, basically the only XML is a couple of lines for creating a servlet, enabling scanning with autowiring + package, and possibly defining a resolution strategy for the view.
eg.
@Controller public class WebController { @RequestMapping(value="/pages/Home.htm", method=RequestMethod.GET) public ModelMap buildHome(@RequestParam("foo", required=false) String foo){ return fillInHomePageData(foo); }
In a degenerate resolution strategy, it can, for example, automatically go to the jsp / pages / Home.jsp search and build it with the data you returned.
source share