View RSS Feed

Recent Blogs Posts

  1. Using Spring Web Flow Part 2

    by , 11-30-2011 at 05:00 AM
    In the previous article, we looked at the components of Spring Web Flow. In this article, I will tie all the pieces together for the application.

    As you know, Spring Web Flow provides a powerful controller to control the user navigation in case your application requires it. Below is the definition of a simple flow to carry out a booking process is shown graphically below:

    Why Spring Web Flow
    We know that defining and understanding page flow of a complex web application ...

    Updated 12-05-2011 at 01:45 PM by Spring Framework

    Categories
    Webflow , MVC , Spring 3 , Web Flow , Spring Flow
  2. Using Spring Web Flow Part 1

    by , 11-30-2011 at 04:52 AM
    In a previous article, I gave an introduction to Spring Web Flow. In this article, I will delve into the details of how to use Spring Web Flow.

    In Spring Web Flow, a flow is defined by three primary elements: states, transitions, and flow data. States are points in a flow where something happens. Consider if you want to plan a short holiday in Florence. You need to first choose your flights, then you choose your hotel, you might also choose a car, etc. Similarly, as a flow progresses, ...
  3. How to Handle Input with Spring MVC

    by , 11-29-2011 at 02: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. ...
  4. Introduction to Spring Web Flow

    by , 11-29-2011 at 02:49 AM
    When you are developing an user interaction for an application, one of the most challenging aspects is to define a proper narrative for the behavior of the application so that the user can get into a flow while using the application. Sometimes it is necessary to step a user through a process, such as ordering a plane ticket. This is called a flowed application. Now is a possible to use any web framework, such as Struts or Java Server Faces, in order to do this. Unfortunately none of them properly ...
  5. Finding the Appropriate View in Spring

    by , 11-28-2011 at 01:19 AM
    In my previous tips we have gone through calling the appropriate RESTful methods, returning the results, and the initial parts of the determining the view involving determining the appropriate media type and looked at factors that could influence that decision. In the last tip on RESTful services I will show how the appropriate view is selected.

    Given that our previous post focused on the ContentNegotiatingViewResolver, one would expect that this view resolver directly resolves the ...

    Updated 11-30-2011 at 01:52 PM by Spring Framework

    Categories
    MVC , REST , Resource , View Helper
  6. Factors Influencing Media Type Selection in Spring

    by , 11-28-2011 at 01:17 AM
    In my previous tips, we looked at the components Spring uses to determine the appropriate media type for the results returned. We know that the ContentNegotiatingViewResolver is used to determine what the appropriate media type is for the results. I will discuss the second part of the strategy used for making this determination. This involves factors that influence the requested media type(s).

    After the ContentNegotiatingViewResolver has determined the requested media type, there ...

    Updated 11-30-2011 at 01:51 PM by Spring Framework

    Categories
    MVC , REST , Spring 3 , Resource
  7. Determining the Requested Media Type in Spring MVC

    by , 11-28-2011 at 01:12 AM
    In my previous tips, we looked at the components Spring uses to determine the appropriate media type for the results returned. We know that the ContentNegotiatingViewResolver is used to determine what the appropriate media type is for the results. I will discuss the first part of the strategy used for making this determination. This involves determining the requested media type(s).

    When the controllerís handler method finishes, and a logical view name is usually returned. The DispatcherServlet ...

    Updated 11-30-2011 at 01:44 PM by Spring Framework

    Categories
    View Helper , MVC , REST , Spring 3 , Resource
  8. Defining the Page View with Tiles View Resolvers in Spring MVC

    by , 11-27-2011 at 10:41 PM
    Following on from my previous tip, I will now define the page view from our previous tip. Using Tiles properly, the home page is composed of several distinct pieces. The main_template.jsp file describes the common layout for all pages in the Springexample application, while home.jsp displays the main content for the home page. Plus, carForm.jsp and login.jsp provide additional common elements.
    The home.jsp is where the home page request finishes its journey. It picks up the list of Cars ...
  9. Using Tiles in Spring MVC

    by , 11-27-2011 at 10:39 PM
    In earlier tips, I talked about using Spring MVC and the use of different view technologies. In this tip, I will look at Tiles as a view technology for Spring MVC. Tiles was initially built to be used with the Struts Framework. But as it is a powerful view technology it has been reused by other web frameworks. To use Tiles with Spring MVC you need to register the Tilesí view resolver as a bean with the applicationís xml file, springexamples.xml.

    Java Code:
    <bean class= "org.springframework.web.servlet.view.tiles2.TilesViewResolver"/>
    ...
    Tags: spring mvc, tiles Add / Edit Tags
    Categories
    MVC , Tiles , Spring 3
  10. How to Test Your Spring MVC Controller

    by , 11-27-2011 at 10: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 doesnít need you to mock any Spring or other specific objects. I will create a test object using standard naming conventions, ...
    Categories
    MVC , Controller , Test
  11. Define a Controller in Spring MVC

    by , 11-27-2011 at 10: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 ...
    Categories
    Spring 3 , MVC , Controller
  12. Spring MVC Basics

    by , 11-27-2011 at 10:03 PM
    Spring MVCís key component is the DispatcherServlet. This servlet that functions as Spring MVCís front controller. Like any servlet, DispatcherServlet must be configured in the web applicationís web.xml file. If you need to setup the Dispatcher Servlet it is relatively straightforward. Below is what needs to be added to the web.xml file.

    Java Code:
    <servlet> 
         <servlet-name>springexamples</servlet-name> 
           <servlet-class>org.springframework.web.servlet.DispatcherServlet
    ...
    Tags: spring mvc Add / Edit Tags
    Categories
    MVC , Spring 3
  13. Using View Helper in Spring MVC

    by , 11-16-2011 at 04:08 PM
    When you are looking to create the web front-end to your application, anyone with exposure to design patterns would apply the MVC pattern for this aspect of the application. There are a number of ways to do this, in Spring Framework, the means of accomplishing this is via an application controller and page controllers combined with a gateway servlet. This design resolves three important concerns of request processing:
    1. Request interception
    2. Invoking business components from page controllers
    3. Resolving
    ...
    Categories
    View Helper , MVC