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. mysql大表优化

    https://segmentfault.com/a/1190000006158186 https://tech.meituan.com/mysql-index.html http://www.cnb ...

  2. state介绍

    state是salt最核心的功能,通过预先定制好的sls(salt state file)文件对被控主机进行状态管理,支持包括程序包(pkg).文件(file).网络配置(network).系统服务( ...

  3. Redis need tcl 8.5 or newer

    hadoop@stormspark:~/workspace/redis2.6.13/src$ make testYou need tcl 8.5 or newer in order to run th ...

  4. 登陆sharepoint的主页,提示:文件存在(异常来自 HRESULT:0x80070050)

    用sharepoint搭建了Project2007的服务器之后,由于我们公司管理域的服务器崩溃了,必须重新再加一次域,而域和服务器是关联的,即使域的名字一样,但该名字所对应的ID是不一样的,会导致一些 ...

  5. stl-stack+括号配对问题

    栈:stl的一种容器,遵循先进后出原则,,只能在栈的顶部操作,就像放盘子一样,洗好的盘子叠在上面,需要用时也是先从顶部拿.不允许被遍历,没有迭代器 基本操作: 1.头文件#include<sta ...

  6. CNN、RNN、DNN

    一:神经网络 技术起源于上世纪五.六十年代,当时叫感知机(perceptron),包含有输入层.输出层和一个隐藏层.输入的特征向量通过隐藏层变换到达输出层,由输出层得到分类结果.但早期的单层感知机存在 ...

  7. Django的cookie学习

    为什么要有cookie,因为http是无状态的,每次请求都是独立的,但是我们还需要保持状态,所以就有了cookie cookie就是保存在客户端浏览器上的键值对,别人可以利用他来做登陆 rep = r ...

  8. 215. Kth Largest Element in an Array(QuickSort)

    Find the kth largest element in an unsorted array. Note that it is the kth largest element in the so ...

  9. iPhone iPad 各种控件默认高度

    iPhone和iPad下各种常见控件的宽度和标准是一样的,所以这里就用iPhone说明. 以下是常见的几种控件的高度.Statusbar,Navigationbar和Tabbar的宽度极其图标大小. ...

  10. 在java工程中导入jar包的注意事项

    在java工程中导入jar包后一定要bulid path,不然jar包不可以用.而在java web工程中导入jar包后可以不builld path,但最好builld path.