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= " Save " >
</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