MCQs Test!! VB Basic Test !! Essentials of VB !! Creating User Services !! function !! Anatomy !! GK March-2019 !! DATA TYPES IN JAVA !! Classes ,Constructor ,Methods,Inheritance !! Ecology-I !! Biology 2019 !! Gk april 2019 !! Biology (living world) !! Plant anatomy !! CELL STRUCTURES AND FUNCTION !! General biology !! Human physiology !! Data structure !! Ecology-II !! GK TEST !! Reproduction in plants !! Human reproduction !! The ABC of C !! Operating system set1 !! Operating system set2 !! Gk and current affairs !! Animal kingdom !! Number system !! Animal kingdom-II !! Gk TEST-III !! Number series !! Microorganisms !! Interview question in c !! Time and Work !! Percentage !! General history !! Average !! Cells !! Locomotion and Movement !! paging !! Bacteriology !! Page replacement policy !! Secondary memory and Disk scheduling !! Introduction of Nervous System and neurons !! Plant harmones !! Transport and Mineral Nutrition in Plants !! Neurotransmitters !! Modern Indian History !! Photosynthesis in Plants !! Modern Indian History-II !! Plant respiration !! Environment & Biodiversity !! Environment & Biodiversity - II !! Algae, Bryophytes, Pteridophytes !! Area !! Cricket !! Days of the Year (India and the World) !! Plant Pathology - I !! Indian Transport System !! Plant Pathology - II !! Aptitude !! Biology !! Botany !! C language !! Computer Science !! Core Java !! Gate !! GK !! Mysql !! Operating system !! Physics !! VB-Visual Basic !! Zoology

Spring Framework

Spring Projects

Spring Project 1

Handler Mapping in Spring MVC
Previous Home Next

Spring MVC provide the facility to handle between client request and DispatcherServlet , the DispatcherServlet provide the facility to Handler Mapping Object to map between Request and Handling Object. A Handler Mapping provide the the facility to Client's Url has to be mapped to the Handlers.

Type of Handler Mapping in Spring

The spring MVC provide the four types of handler which are map in the spring mapping file which are following:

  1. BeanNameUrlHandlerMapping
  2. CommonsPathMapHandlerMapping
  3. ControllerClassNameHandlerMapping
  4. SimpleUrlHandlerMapping

 

BeanNameUrlHandlerMapping: The BeanNameUrlHandlerMapping provide the facility to map the simple handler which are come from client bean object. This handler map in following types in spring configuration file:

<beans ...>
<bean 
class="org.springframework.web.servlet.
handler.BeanNameUrlHandlerMapping"/>
<bean name="/welcome.bean" 
class="r4r.co.controller.WelcomeController" />
<bean name="/login.bean" 
class="r4r.co.controller.LoginController" />
<bean name="/registeration.bean" 
class="r4r.co.controller.RegisterationController" />
</beans>

CommonsPathMapHandlerMapping: The CommonsPathMapHandlerMapping provide the facility to the name of URL which are mapped to the controller source file for example if we are to map 'loginPage','registerationPage' and 'welcomePage' to Controllers name LoginController, RegisterationController and WelcomeController,then the mapping information allocate in meta-data in the source files inside the Javadoc comments. This handler mapping example which are following:

<beans>

<bean id="metaHandlerMapping" 
class="org.springframework.web.servlet.handler.
metadata.CommonsPathMapHandlerMapping"/>

</beans>

ControllerClassNameHandlerMapping: This handler provide the facility to handle the more then one Handler Mapping, the Controller name using directly from the Url itself with some modifications. This handler mapping are show in the following:

<beans ...>
<bean 
class="org.springframework.web.servlet.mvc.
support.ControllerClassNameHandlerMapping" />
<bean class="r4r.co.controller.WelcomeController" />
<bean class="r4r.co.controller.HelloGuestController" />
</beans>

SimpleUrlHandlerMapping: This handler provide the facility to handle more then one handler map directly to the Client Request to some Controller object. Example of this handler which are following:

<beans ...>
<bean class="org.springframework.web.servlet.
handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="/welcome.bean">welcomeController</prop>
<prop key="/login.bean">loginController</prop>
<prop key="/registeration.bean">registerationController
</prop>
</props>
</property>
</bean>
<bean id="welcomeController" 
class="r4r.co.controller.WelcomeController" />
<bean id="loginController" 
class="r4r.co.controller.LoginController" />
<bean id="RegisterationController" 
class="r4r.co.controller.RegisterationController" />
</beans>
  1. Example of BeanNameUrlHandlerMapping in Spring MVC
  2. Example of ControllerClassNameHandlerMapping in Spring MVC
  3. Example of SimpleUrlHandlerMapping in Spring MVC
Previous Home Next