Handler mapping in Spring's MVC

xiaoxiao2021-03-06  124

Speaking of mapping issues. . I thought of Controller Front mode (see: http://java.sun.com/blueprints/corej2eepatterns/patterns/frontcontroller.html)

So, mapping problems are mainly to solve which Action to call. .

There are two main ways of mapping handler:

BeannameurlHandlermapping

This is actually the default mode, as long as you do not define its mapping mode in ** - servlet.xml, Spring will automatically select its way.

It is called based on the ID of the Action defined:

such as:

Set some properties of SimpleFormControl

So, it is necessary to add a new User's URL is /adduser.html, and the user wants to log out the system, you can implement it through the URL: /Logout.html.

2. SimpleurlHandlermapping

It is an attribute that places a pair of MapPings that is originally configured such as: can be modified: < Bean id = "mapping" class = "org.springframework.web.servlet.handler.simpleurlhandlermapping"> Logout < / bean> over time with some stuff about Action. . Ha ha

转载请注明原文地址:https://www.9cbs.com/read-126578.html

New Post(0)