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 存放到数组中 $( ...
随机推荐
- How To Set Up vsftpd on CentOS 6
About vsftpd 警告:FTP是天生不安全.如果你必须使用FTP,考虑securing your FTP connection with SSL/TLS.否则,最好use SFTP, a se ...
- 高级工具gprof、gprof2dot.py、dot
可以研究程序性能.函数调用堆栈等,而且能用图标查看. linux环境下 C++性能测试工具 gprof + kprof + gprof2dot - 阁子 - 博客园 gprof.gprof2dot.p ...
- 将helps.php或者functions.php直接进行了加载
TP3系列中functions.php文件默认其实是空文件,很好找.我们可以直接封装代码. Laravel5系列中的path/vendor/laravel/framework/src/Illumina ...
- quick lua目录结构
http://cn.cocos2d-x.org/tutorial/show?id=1138 http://cn.cocos2d-x.org/tutorial/show?id=2385
- 使用NPOI随意创建Excel(含下拉列表)
//创建工作簿 HSSFWorkbook ssfworkbook = new HSSFWorkbook(); //创建工作表(页) HSSFSheet sheet1 = ssfworkbook.Cre ...
- 关于接收json以及使用json
Common: FileIO.cs using System; using System.Collections.Generic; //using System.Linq; using System. ...
- AWR报告-数据库概要信息(一)
Elapse time为两个Snap时间间隔,相当于取样时间差 DB Time : db time= cpu time + wait time(不包含空闲等待)(非后台进程) 说白了就是db tim ...
- norm函数
如果A为向量 norm(A,p) 返回向量A的p范数. norm(A) 返回向量A的2范数,即等价于norm(A,2).
- Codeforces Round #260 (Div. 2) B
Description Fedya studies in a gymnasium. Fedya's maths hometask is to calculate the following expre ...
- hahaha
[问题描述] 小Q对计算几何有着浓厚的兴趣.他经常对着平面直角坐标系发呆,思考一些有趣的问题.今天,他想到了一个十分有意思的题目: 首先,小Q会在x轴正半轴和y轴正半轴分别挑选n个点.随后,他将轴的点 ...