1. 数组接收
@RequestMapping(value="deleteRole.json") @ResponseBody public Object deleteRole(String[] ids){ return systemService.deleteRole(ids); }
页面:
?ids=1&ids=2&ids=3
2. list 接收
package cn.zno.smse.pojo;import java.io.Serializable;import java.util.List;public class SystemUser implements Serializable { /** * */ private static final long serialVersionUID = 1L; private ListroleList; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column SMSE_USER.ID * * @mbggenerated */ private String id; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column SMSE_USER.NAME * * @mbggenerated */ private String name; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column SMSE_USER.USERNAME * * @mbggenerated */ private String username; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column SMSE_USER.PASSWORD * * @mbggenerated */ private String password; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column SMSE_USER.MOBILE * * @mbggenerated */ private String mobile; /** * This field was generated by MyBatis Generator. * This field corresponds to the database column SMSE_USER.EMAIL * * @mbggenerated */ private String email; /** * This method was generated by MyBatis Generator. * This method returns the value of the database column SMSE_USER.ID * * @return the value of SMSE_USER.ID * * @mbggenerated */ public String getId() { return id; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column SMSE_USER.ID * * @param id the value for SMSE_USER.ID * * @mbggenerated */ public void setId(String id) { this.id = id == null ? null : id.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column SMSE_USER.NAME * * @return the value of SMSE_USER.NAME * * @mbggenerated */ public String getName() { return name; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column SMSE_USER.NAME * * @param name the value for SMSE_USER.NAME * * @mbggenerated */ public void setName(String name) { this.name = name == null ? null : name.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column SMSE_USER.USERNAME * * @return the value of SMSE_USER.USERNAME * * @mbggenerated */ public String getUsername() { return username; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column SMSE_USER.USERNAME * * @param username the value for SMSE_USER.USERNAME * * @mbggenerated */ public void setUsername(String username) { this.username = username == null ? null : username.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column SMSE_USER.PASSWORD * * @return the value of SMSE_USER.PASSWORD * * @mbggenerated */ public String getPassword() { return password; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column SMSE_USER.PASSWORD * * @param password the value for SMSE_USER.PASSWORD * * @mbggenerated */ public void setPassword(String password) { this.password = password == null ? null : password.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column SMSE_USER.MOBILE * * @return the value of SMSE_USER.MOBILE * * @mbggenerated */ public String getMobile() { return mobile; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column SMSE_USER.MOBILE * * @param mobile the value for SMSE_USER.MOBILE * * @mbggenerated */ public void setMobile(String mobile) { this.mobile = mobile == null ? null : mobile.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column SMSE_USER.EMAIL * * @return the value of SMSE_USER.EMAIL * * @mbggenerated */ public String getEmail() { return email; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column SMSE_USER.EMAIL * * @param email the value for SMSE_USER.EMAIL * * @mbggenerated */ public void setEmail(String email) { this.email = email == null ? null : email.trim(); } public List getRoleList() { return roleList; } public void setRoleList(List roleList) { this.roleList = roleList; }}
@RequestMapping(value="saveUserAdd.json") @ResponseBody public Object saveUserAdd(SystemUser user) { return systemService.saveUserAdd(user); }
页面:
ps:
和struts2 的 ognl表达式不同之处在于:
框架 | name的值 |
Struts2 | user.roleList[0].id |
SpringMVC | roleList[0].id |