Spring Basic Controller

To start with , the Spring Controller is a Spring MVC functionality, which is an add on the the IOC functionality of Spring.

In the Spring MVC Architecture, The Controller differs from the Front Controller. In this case here is the difference of the two:

Front Controller – Accepts incoming HTTP requests, Only forwards the request to the Controller, then awaits for the final data ( webpage, etc.. ) output to be send out as the HTTP response.

Controller – Accepts the forwarded HTTP request, Handle and do logic in it, It may use a Model Class/Data within it, then sends it back to the Front Controller, which then creates a View to become a response just a response back ( No View involved ).

The Basic Controller

The Controller here will be represented by a single Class. To make a Class a Controller, this has to be implemented in the Class.

– Must be annotated with “@Controller”.
Spring will automatically reconize that this is the Controller Class,
capable of handling requests.

– It can handle request by a method with @RequestMapping annotation.

The detailed explanation is found in this site:

http://spring.io/blog/2011/01/04/green-beans-getting-started-with-spring-mvc/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s