View RSS Feed


Spring MVC Controller

  1. How to Handle Input with Spring MVC

    by , 11-29-2011 at 03:57 AM
    Spring MVC is structured to handle state management, workflow and validation. It is an application of the Model-View-Controller pattern. As with all things Spring, it follows the principles of loose coupling and flexibility. When a request is made, it reaches the DispatcherServlet whose role is to forward the request to the relevant Spring MVC controller, it is the controller that processes the request. In this article we will look in depth in what a Spring Controller does when it processes input. ...
  2. RESTful Controllers in Spring

    by , 11-28-2011 at 01:47 AM
    In my previous tip, I presented to you an overview of how to handle RESTful URLs. In this tip, I will followup will look at RESTful Controllers. From my previous posts, I believe you have surmised that Spring MVCs model is a very flexible framework for for writing controller classes. Almost any method with almost any signature can be annotated to handle a web request. Although this is nice for writing RESTless controllers, it is not ideal for writing RESTful controllers. The reason is that controllers ...
    MVC , Controller , REST , Spring 3
  3. How to Test Your Spring MVC Controller

    by , 11-27-2011 at 11:21 PM
    In my previous post, I showed you how to create a HomeController for our home page in your application. You might have noted that there was little code that linked your HomeController with Spring that was included. It is simply a plain old java object (POJO). In this tip, we will look at unit testing your controller. Unit testing your controller will be very easy since a POJO doesnt need you to mock any Spring or other specific objects. I will create a test object using standard naming conventions, ...
    MVC , Controller , Test
  4. Define a Controller in Spring MVC

    by , 11-27-2011 at 11:17 PM
    When you work with Spring MVC, after configuring the Dispatcher Servlet in order to build an application you need to do the following:
    Define controllers that invoke business logic and create a ModelAndView object.
    Visualization component like JSP, Velocity or FreeMarker.
    Annotation configuration or XML to wire the components together

    The first thing that you will most likely do is to define a home page controller. Spring provides a number of controllers to use ...
    MVC , Controller , Spring 3