Thursday, November 24, 2011

What is a Controller in Spring Framework

In Spring framework, all the requests sent by the dispatcher servlet normally directed to a controller class. This controller class is mapping those requests to each process & execute the requested inputs. In a project there can be multiple controllers defined for different purposes. All these controllers refers to the same dispatcher servlet. As I mentioned in the previous post, @RequestMapping keyword is used to map the dispatcher servlet with the controller class. 
In a Controller mapping there are two types of mapping as GET & POST. Normally there can be many GET methods in a controller while one POST method is employed. GET request method is used to get the requests from the user do the desired work & output results into a view( jsp pages). A GET request is shown below.


A POST request is used to post the results in to a page as usual. A POST request is shown below.


So this is about the basic concept of the Spring controller. Hope the post is useful for you & feel free to make a comment.

1 comment: