SpringSource Spring Framework tutorials and examples. Focusing on Spring 3 and above.
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 02:45 PM by Spring Framework
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,
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.
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
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 02:52 PM by Spring Framework
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 02:51 PM by Spring Framework
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 02:44 PM by Spring Framework
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
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"/>
<bean class= "org.springframework.web.servlet.view.tiles2.TilesViewResolver"/>
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,
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
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>
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: Request interceptionInvoking business components from page controllersResolving