The way to visit the annotated development of SSM-SPRINGMVC-16:SPRINGMVC in small and medium-sized discourse

Source: Internet
Author: User

------------I do not have him, but the hand is ripe, humble and foolish, and eager to be hungry-------------

Access can be specified, for example, you get to enter the landing page through the post to send Ajax database check or post to submit the user name password, and finally forwarded

It's a normal pattern.

With the restriction of access mode, you can only allow access to some kind of access, add the same path, or you can use different processing methods by different ways of access.

The cases are as follows:

Package Cn.dawn.day10annotationcontroller;import Org.springframework.stereotype.controller;import Org.springframework.web.bind.annotation.requestmapping;import Org.springframework.web.bind.annotation.requestmethod;import Javax.servlet.http.httpservletrequest;import Javax.servlet.http.HttpServletResponse;/** * Created by Dawn on 2018/3/24.*//*Annotation Definition Processor*/@Controller/*defining the Processor access path*/@RequestMapping ("/controller1") Public classMyacontroller {/*wildcard, only the POST request can access the*/@RequestMapping (Value="/login", method =requestmethod.post) Publicstring Dologin (String uname,string upwd) throws Exception {System. out. println (uname); System. out. println (UPWD); return " First"; }    /*wildcard is only available if a GET request can access the*/@RequestMapping (Value="/login", method =requestmethod.get) PublicString Dologin () throws Exception {return " First"; }}

As you can see here: The method name and the value of the above annotation have access to the same path as the two, but, by the way the request is different, they will execute a different method

The way to visit the annotated development of SSM-SPRINGMVC-16:SPRINGMVC in small and medium-sized discourse

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.