Spring MVC does not submit a solution to the Controller method under annotation development

Source: Internet
Author: User

This question is very strange, do not understand why, but know how to solve, if you know why the words want to comment on me!

The form submission code is as follows:


<formclass="Form Clearfix"action="${Website}Register "method="POST">class="title">Intelligent Code Control Access control system<spanclass="in">Registered</span >/<ahref="Tologin"class="Out">Login</a><pclass="Float"><labelfor="Name"><iclass="FA Fa-envelope"></i>Mailbox</label><inputclass="J_email"name="Email"placeholder="Email Address"Required Autofocus/><spanclass="Tips J_emailtip">Mailbox Input Error</span></p><pclass="Float"><labelfor="Tel"><iclass="FA Fa-phone"></i>Cell phone</label><inputclass="J_tel"name="Tel"placeholder="Phone number"Required/><spanclass="Tips J_teltip">Phone Number input Error</span></p>

class=name= placeholder=/>
About this line of code, if you need to be in the Controller method to get the email parameters of the front end to write as name = "XXX", just beginning to write to me is type = "XXX" results when the request is not in the parameter list.


The address of the action that was submitted from the beginning of the form and the URL address of the method inside the backend controller are the same, but it is not the controller method inside, it is important to note that the front end has defined the parameter rules (that is, must be entered):

Required
Is this input is not empty, just start testing, I put the method inside the parameters are all shielded so that is certainly not to the method inside, before the time is with parameters, but also to the method inside, before using the annotation development with parameters, as follows:
@RequestParam ("name"name

If you want to solve this kind of problem with annotation development, you should add a require property to the @requestparam and set it to false, so that you can go inside the method, but this problem appears, the front end of this parameter is required to input, But the background words this parameter we set to IS can not input, so there is inconsistency between the front and back of the problem, so there is a way to correct, that is, without annotations, as follows:

String name,string Tel,string pass,passsure
However, the name should be the same as the foreground definition, which solves the problem.

Spring MVC does not submit a solution to the Controller method under annotation development

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.