Spring MVC three ways to configure XML Access controller

Source: Internet
Author: User

(i) One by one mapping by name (default)

(ii) Specify the mapping by a simple URL, key means the access URL value is the Bean's ID

(iii) by controlling the class name controller of the class, the first letter of the class name needs to be lowercase when accessing

<!--Configuring Controller--

<bean id= "Logincontroller" name= "/login.do" class= "Com.beifeng.controller.LoginController" ></bean>

<!--configuration Map Processor: Name to map the Find controller (default)--

<bean class= "Org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping" ></bean>

<!--Configuring the mapping Processor: Find a controller with a simple URL--

<bean class= "Org.springframework.web.servlet.handler.SimpleUrlHandlerMapping" >

<property name= "Mappings" >


<prop key= "Login1.do" >loginController</prop>




<!--configuration Mapping Processor: Class name controller for the control class, and the first letter of class name needs to be accessed in lowercase--

<bean class= "Org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping" ></bean>

<form action="login.do">

Account: <input type="text" name="UserName"/><br/>

Password: <input type="password" name="USERPW"/><br/>

<input type="Submit" value=" login "/>


(ii) Replace the URL of action with login1.do when visiting

(iii) Replace the URL of action with logincontroller.do when visiting

Spring MVC three ways to configure XML Access controller

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.