We will see later how to glue all the pieces together. The parameters passed to the ModelAndView constructor mean that we are selecting a view named "hello" and passing the user object that will be referred as "user" in the view. We are initializing a User object and returning a ModelAndView instance. Method hello is annotated with and the annotation values configure this method as handling requests which URL matches /example and the used HTTP method is GET. We annotate our Controller with so the Spring container knows that this class represents a Spring MVC controller, ie. Return new ModelAndView("hello", "user", user) User user = new User("John Doe", "Some random message") Import class ExampleController = RequestMethod.GET, value="/example")
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |