Article From:

1.Create a new web dynamic project in Tomcat

2.Import jar package

3.springMVCThe browser sends a request to process the request to a page. It needs to build a processor to process the browser request, so the third step to create a handler class needs to inherit the controller interface.

The handler defines what type of object to create

Then call the addObject method to set attributeValue for AttributeName, and then call the setViewName method to set the page to jump.

4.Write the page to jump and get attributeValue through ${AttributeName}

5.In the third step, only a processing class is created, and there is no object of that class. So we need to write a spring container under the class path to generate the proxy object of the processing class. The ID starts with / and ends with. * (e.g. / some. do).

6Get the ID of the proxy object by registering the central dispatcher Dispatcher Servlet in web.xml, as follows

<!– Register the central dispatcher – & gt;
<servlet-name>springContainer name & lt; / servlet-name & gt;
<!– Specify the location and name of the Spring MVC configuration file – & gt;
<!– Create the current servlet instance when starting the application – & gt;
<url-pattern>The value of /*, not recommended as /, is best written as an extension, such as:.Do,.go.


Link of this Article: Spring MVC Writing Steps

Leave a Reply

Your email address will not be published. Required fields are marked *