struts2 传递数组、List、Map
struts2 传递数组、List、Map
jsp文件
数组:
<s:textfield name="ages" value="a1"></s:textfield>
<s:textfield name="ages" value="a2"></s:textfield>
<s:textfield name="ages" value="a3"></s:textfield>
<s:textfield name="names[0]" value="n1"></s:textfield>
<s:textfield name="names[1]" value="n2"></s:textfield>
<s:textfield name="names[2]" value="n3"></s:textfield>
List:
<s:textfield name="lastName[0]" value="11"></s:textfield>
<s:textfield name="lastName[1]" value="21"></s:textfield>
<s:textfield name="lastName[2]" value="31"></s:textfield>
Map
<s:textfield name="maid.mary"></s:textfield>
<s:textfield name="maid['beth']"></s:textfield>
java文件
System.out.println(ages.toString()+names.toString()+getLastName().toString());
Map map = getMaid();
System.out.println(map.get("mary")+":"+map.get("beth"));
/*数组*/
private String[] ages;
/**
* @return the ages
*/
public String[] getAges() {
return ages;
}
/**
* @param ages the ages to set
*/
public void setAges(String[] ages) {
this.ages = ages;
}
private String[] names = new String[10];
/**
* @return the names
*/
public String[] getNames() {
return names;
}
/**
* @param names the names to set
*/
public void setNames(String[] names) {
this.names = names;
}
private List<Integer> lastName;
/**
* @return the lastName
*/
public List<Integer> getLastName() {
return lastName;
}
/**
* @param lastName the lastName to set
*/
public void setLastName(List<Integer> lastName) {
this.lastName = lastName;
}
private Map maid;
/**
* @return the maid
*/
public Map getMaid() {
return maid;
}
/**
* @param maid the maid to set
*/
public void setMaid(Map maid) {
this.maid = maid;
}
struts2 传递数组、List、Map的更多相关文章
- jquery ajax传递数组给php
写成:var data = {'item[]':item}; $.post(url,data,function(return_data) 写成item:item会导致数据缺失. 更多:http://w ...
- Go语言学习笔记(三)数组 & 切片 & map
加 Golang学习 QQ群共同学习进步成家立业工作 ^-^ 群号:96933959 数组 Arrays 数组是同一种数据类型的固定长度的序列. 数组是值类型,因此改变副本的值,不会改变本身的值: 当 ...
- Restful传递数组参数的两种方式
第一种,直接传递数组 js直接传递数组 var data = ["123","456"];that.loadDictionarys(data).subscrib ...
- springMVC通过ajax传递参数list对象或传递数组对象到后台
springMVC通过ajax传递参数list对象或传递数组对象到后台 环境: 前台传递参数到后台 前台使用ajax 后台使用springMVC 传递的参数是N多个对象 JSON对象和JSON字符串 ...
- JavaScript 数组函数 map()
JavaScript 数组函数 map() 学习心得 map()函数是一个数组函数: 它对数组每个原素进行操作,不对空数组进行操作: 不改变原本的数组,返回新数组: arr.map(function( ...
- 前端AJAX传递数组给Springmvc接收处理
前端传递数组后端(Spring)来接收并处理: <!DOCTYPE html> <html> <head> <meta charset="UTF-8 ...
- 在ASP.NET MVC中以post方式传递数组参数的示例
最近在工作中用到了在ASP.NET MVC中以post方式传递数组参数的情况,记录下来,以供参考. 一.准备参数对象 在本例中,我会传递两个数组参数:一个字符串数组,一个自定义对象数组.这个自定义对象 ...
- jquery ajax post 传递数组 ,多checkbox 取值
jquery ajax post 传递数组 ,多checkbox 取值 http://w8700569.iteye.com/blog/1954396 使用$.each(function(){});可以 ...
- Jquery post 传递数组给asp.net mvc方法
以批量删除数据为例 做批量删除会需要传递要删除的数据ID数组 function RemoveLog(){ var postModel=[]; //遍历复选框获取要删除的数据ID 存放到数组中 $( ...
随机推荐
- Docker第三方项目小结
软件项目的成功常常根据其催生的生态系统来衡量.围绕或基于核心技术构建的项目增添了功能和易用性,它们常常日臻完善.Docker就是一个典例,有众多第三方项目扩展.补充或改进Docker. •Docker ...
- Cocos2dx lua 3D实例代码
用cocoside 创建一个项目 cocos2dx lua 项目即可 ,然后替换掉gamescene 就可以,具体效果还有函数的参数,相信大家一看就明白.简单说下ide 创建的 cocos lua 项 ...
- Python 中translate()与replace()区别
translate函数和replace函数一样,用于替换字符串中的某个部分,但是和replace不同,translate只处理单个字符,而且可以同时进行多个替换.在使用translate函数转换之前, ...
- 使用KNN对MNIST数据集进行实验
由于KNN的计算量太大,还没有使用KD-tree进行优化,所以对于60000训练集,10000测试集的数据计算比较慢.这里只是想测试观察一下KNN的效果而已,不调参. K选择之前看过貌似最好不要超过2 ...
- Floyd-Warshall算法,简称Floyd算法
Floyd-Warshall算法,简称Floyd算法,用于求解任意两点间的最短距离,时间复杂度为O(n^3). 使用条件&范围通常可以在任何图中使用,包括有向图.带负权边的图. Floyd-W ...
- Excel 函数
Excel 函数: 一.定义: Excel 函数即是预先定义,执行计算.分析等处理数据任务的特殊公式. 二.结构: 1.单一结构 =函数名(参数1,参数2,参数3.....) 示例:=sum(A3:A ...
- 查找练习 hash——出现过的数字 分类: 查找 2015-06-18 17:30 7人阅读 评论(0) 收藏
查找练习 hash--出现过的数字 *Time Limit: 1000ms Memory limit: 65536K 有疑问?点这里^_^ 题目描述 有一个数据字典,里面存有n个数字(n<=10 ...
- python3数据类型
python基本数据类型 Python3 中有六个标准的数据类型: Number(数字) String(字符串) List(列表) Tuple(元组) Sets(集合) Dictionary(字典) ...
- JAVA基础知识之Queue集合
Queue接口 PriorityQueue类 Deque与ArrayDeque LinkedList 各种线性表性能分析 Queue接口 Queue用来模拟队列这种数据结构,遵循先进先出原则(FIFO ...
- DAG模型
数字三角形: 1.递归计算 int solve(int i,int j) { :max(solve(i+,j),solve(i+,j+))); } 2.记忆化搜索,不用指明计算顺序,并且保证每个状态只 ...