Methods of JSP to control layer of Java

Source: Internet
Author: User

Methods of JSP to control layer of Java
1.form Table Single <input type= "Submit" > Submit, the parameters submitted to the background in the form table order
<form method= "POST" action= "Saveinfo" >
<input type= "text" name= "username" >usrenamexxx</input>
<input type= "Password" name= "Wpassword" id= "Wpassword" value= "wpasswordxxx"/>
<input type= "Submit" value= "&nbsp; Save &nbsp;" >
</form>
The path to the background is: Saveinfo method post
Background received by: @RequestMapping (value= "Saveinfo", Method=requestmethod.post)
Value passed: username=usrenamexxx;wpassword=wpasswordxxx
2.a Label
One, <a href= "Wanttowhere/${userid}/${wpassword}" style= "color: #428bca;" >xxxxxx</a>
Suppose ${userid}=123;${wpassword}=abc;
The path to the background is: "WANTTOWHERE/123/ABC";
Background received by: @RequestMapping (value= "Scoreimport/{userid}/{wpassword}")
Public String xxxx (@PathVariable integer userid, @PathVariable integer wpassword) {
Return "";
}
Note: Variables in background {UserID} and {Wpassword} may not be the same as the foreground.
Pass over value: USERID=123;WPASSWORD=ABC;
3. Using methods to pass
Eg1:function Classselect () {
Window.location.href= "<%=request.getcontextpath ()%>/pathxxx/" + "Sid" + "/" +$ (' #s '). Val ();
}
The SID can be a fixed value or a variable, $ (' #s '). Val () is an input box or other value with ID s
The path to the background is: "Wanttowhere/(SID Value)/(#s的值)";
Background received by: @RequestMapping (value= "Scoreimport/{userid}/{wpassword}")
Public String xxxx (@PathVariable integer userid, @PathVariable integer wpassword) {
Return "";
}
Eg2:function Xxxselect () {
Window.location.href= "<%=request.getcontextpath ()%>/xxxselect?id=" +$ (' #xxx '). Val ();
}
The path to the background is: xxxselect another variable with the past id= ($ (' #xxx '). Val () value);
Background received by: @RequestMapping (value= "Xxxselect")
Public String getlistselect (Model model,integer ID) {
return xxx;
}
Note: The name of the variable with the past and the names of the parameters in the method must be the same;
Another: New encounter will add in, wrong, or I did not add in, welcome to correct, thank you!

Methods of JSP to control layer of Java

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.