Type of controller parameter binding
The controller has 6 types of binding parameters. No parameters (system default type), Simple Type (intager,double), Pojo Class (object), array, set, HashMap, etc.
We use an example to express it in code:
Users (UID,UNAME,UPASS,BIRTHDAY,CID)
Province (Cid,cname)
1) without parameters, the query does not require parameters, such as querying all user information. (Two-table connection query) Findallusers, There are several ways to accept data, and carry parameters to jump to other pages. This is detailed in the previous section. It's not going to show up here.
2) Simple type. Here I'm using Intager, passing in an ID to delete a user. Note:the UID self-break is the same as the Name property of the JSP page get value.
3) a Pojo type. Pass in an object, set the object ID, query the user information by ID, Note:the tag name passed in the JSP page is the same as the database field
4) incoming number group, int type, implement bulk delete. Note: The parameter uid must be the same as the JSP page label Name property
5) Set: parameter is a string, with Ajax incoming, with jquery by the line local refresh, using the @requestmapping annotation
1 /**2 * method that is specified by the Ajax method when the form's User name text box loses focus, @requestmapping the specified URL commits3 * 4 * @paramUESR5 * @return6 */7@RequestMapping (value = "/isvailduname", method = {8Requestmethod.post}, produces = "Application/json;charset=utf-8")9 Public@ResponseBodyintisvailduname (String uname) {TenUsersbean user =NewUsersbean (); One User.setuname (uname); A returnusersservice.haveusers (user); -}
Spring-mvc---The type of controller parameter binding