Section II (requestmapping request) Learn about Silicon Valley-SPRINGMVC video tutorial

Source: Internet
Author: User

Project, create a test class Springmvctest

@Controller @requestmapping ("/springmvc1") Public classSpringmvctest {Private Static FinalString SUCCESS = "SUCCESS"; /*** @RequestMapping In addition to the modification method, you can also modify class * 1, class definition: Provide the requested mapping information.     Equivalent to the root of the Web App * 2, Method: Provides further subdivision mapping information. * @return     */@RequestMapping ("/testrequestmapping")     PublicString testrequestmapping () {System.out.println ("Testrequestmapping"); returnSUCCESS; }}

Notice here that there are @requestmapping annotations on the class, and the method of writing the Testrequestmapping URL mapping request
This time the address path is: http://localhost:xxxx/springmvc1/testRequestMapping can access the Testrequestmapping method.


2. Requestmappging modification request type Get and post

/**@return*/= "/testmethod", method = requestmethod.post)  public String TestMethod () {    System.out.println ("TestMethod");     return SUCCESS;}
If you use the Get method request, the following error will occur adding the test Post request HTML code
<form action= "Springmvc1/testmethod" method= "POST" >    <input type= "Submit" value= "Post submission Method" ></ Form>
This video tutorial Address Wisdom Podcast _springmvc+mybatis a full set of video tutorials

Section II (requestmapping request) Learn about Silicon Valley-SPRINGMVC video tutorial

Related Article

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.