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 List<SystemRole> roleList; /**
* 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<SystemRole> getRoleList() {
return roleList;
} public void setRoleList(List<SystemRole> roleList) {
this.roleList = roleList;
}
}

SystemUser.java

    @RequestMapping(value="saveUserAdd.json")
@ResponseBody
public Object saveUserAdd(SystemUser user) {
return systemService.saveUserAdd(user);
}

页面:

<form>
<tbody>
<tr>
<td colspan="2">
<b>用户角色</b>
<hr>
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="roleList[0].id" value="21943DC037B343EDE053433210AC4939" id="roleList_0">
<label for="roleList_0">系统管理员</label>
</td>
<td>
<input type="checkbox" name="roleList[1].id" value="38950038-53cd-11e6-9619-00163e001b41" id="roleList_1">
<label for="roleList_1">b</label>
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="roleList[2].id" value="4bcb3f3c-53cd-11e6-9619-00163e001b41" id="roleList_2">
<label for="roleList_2">c</label>
</td>
<td>
<input type="checkbox" name="roleList[3].id" value="526dc5e4-53cd-11e6-9619-00163e001b41" id="roleList_3">
<label for="roleList_3">d</label>
</td>
</tr>
</tbody>
<form>

ps:

和struts2 的 ognl表达式不同之处在于:

框架 name的值
Struts2 user.roleList[0].id
SpringMVC roleList[0].id

重大发现 springmvc Controller 高级接收参数用法的更多相关文章

  1. springmvc controller层接收List类型的参数

    Spring MVC在接收集合请求参数时,需要在Controller方法的集合参数里前添加@RequestBody,而@RequestBody默认接收的enctype (MIME编码)是applica ...

  2. SpringMVC Controller接收参数总结

    本文中Controller的开发环境如下表格所示,Maven对应POM配置如下代码段所示: 系统/工具 版本号OS Windows 7 Home BasicJava 1.7.0_79Eclipse M ...

  3. springmvc 传递对象数组参数 property path is neither an array nor a List nor a Map

    Spring MVC 3: Property referenced in indexed property path is neither an array nor a List nor a Map ...

  4. springmvc Controller接收前端参数的几种方式总结

    (1) 普通方式-请求参数名和Controller方法的参数一致 @Controller @RequestMapping("/param") public class TestPa ...

  5. SpringMVC详解一、@RequestMapping注解与Controller接收参数

    SpringMVC详解一.@RequestMapping注解与Controller接收参数 https://blog.csdn.net/mxcsdn/article/details/80719258 ...

  6. 【springmvc Request】 springmvc请求接收参数的几种方法

    通过@PathVariabl注解获取路径中传递参数 转载请注明出处:springmvc请求接收参数的几种方法 代码下载地址:http://www.zuida@ima@com/share/1751862 ...

  7. springmvc 传递和接收数组参数

    java url中如何传递数组,springMVC框架controller类如何接收数组参数? 下面介绍一下URL中传递数组参数方法: dd.do?titles[]=col1&titles[] ...

  8. springmvc接收参数

    springmvc执行流程 搭建ssm框架:http://www.cnblogs.com/liyafei/p/7955413.html 1:从表单中接收 普通请求参数 结构目录 role.html 1 ...

  9. SpringMVC中控制器接收JSP页面表单的参数接收方式详解及细节注意(400错误)

    控制器方法中参数的接收 (1)以前的参数接收: String  param = req.getParameter(name): (2)SpringMVC简化这个操作,只需要给控制器方法添加参数即可 a ...

随机推荐

  1. 使用sqldeveloper连接服务器端数据库

  2. LESS CSS 实例

    值得参考的 10 个 LESS CSS 实例   2 收藏(185) LESS, Sass 和其他 CSS 预处理器是一种超棒的方法用来扩展 CSS 功能,使之更适合程序员.你可以使用变量.函数.混合 ...

  3. Oracle免客户端InstantClient安装使用

    正常情况下,用PL/SQL等软件连接Oracle,需要安装Oracle客户端软件,一般安装oracle客户端差不多需要2G左右的硬盘空间,但如果我们仅仅是连接数据库进行查询和执行一些相应的语句而不进行 ...

  4. 输入N组父子对,求父子对所组成的二叉树的高度----17年某公司的笔试题

    题目的大致意思如下: 输入N组数,一组数代表一个父子对(如,0 1,0代表父节点,1代表子节点),求这N组数所组成的二叉树的高度: 例如: 输入:6  0 1  0 2  1 3  1 4  2 5 ...

  5. conductor任务域

    任务域 任务域有助于支持任务开发.这个想法是相同的“任务定义”可以在不同的“域”中实现.域名开发人员控制的任意名称.因此,当工作流程启动时,调用者可以在工作流中的所有任务中指定哪些任务需要在特定域中运 ...

  6. Fragment 实现拍照,相册选图,设置头像功能

    设置不成功,http://bbs.csdn.net/topics/391112964 采纳问题回答:这个是fragment没有收到这个回调,原因不多说了,,,你用你对应的ragment.startAc ...

  7. Spring WebMVC 4.1返回json时 406(Not Acceptable)

    1.问题现象Tomcat7+Spring4.1.4,返回json字符串时发生406错误 The resource identified by this request is only capable ...

  8. Spring @Configuration

    下面是一个典型的spring配置文件(application-config.xml): <beans> <bean id="orderService" class ...

  9. Windows系统之hosts文件

    对于Hosts文件相信很多Win7的系统用户会比较陌生,其实Hosts是一个没有扩展名的系统文件,可以用记事本等工具打开,其作用就是将一些常用的网址域名与其对应的IP地址建立一个关联“数据库”,所以功 ...

  10. jQuery对象转换为DOM对象(转)

    jQuery对象转换为dom对象 只有jQuery对象才能调用jQuery类库的各种函数,同样有些dom对象的属性和方法在jQuery上也是无法调用的,不过基本上jQuery类库提供的函数包含了所有的 ...