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 存放到数组中 $( ...
随机推荐
- bodybuilding
增大肌肉块的14大秘诀:大重量.低次数.多组数.长位移.慢速度.高密度.念动一致.顶峰收缩.持续紧张.组间放松.多练大肌群.训练后进食蛋白质.休息48小时.宁轻勿假. 1. 大重量.低次数:健美理论中 ...
- git修改文件名大小写的方法。
首先,在git命令行里面运行: git config core.ignorecase false 此命令是全局设置,以后在此机子上clone出来的git仓库工程都沿用此设置.当然,以前就已经clone ...
- Python源代码目录组织结构
- HDU 5795:A Simple Nim(博弈)
http://acm.hdu.edu.cn/showproblem.php?pid=5795 A Simple Nim Problem Description Two players take t ...
- JavaScript和angularJs语法支持严格模式:”use strict”
如果给JavaScript和angularjs代码标志为“严格模式”,则其中运行的所有代码都必然是严格模式下的.其一:如果在语法检测时发现语法问题,则整个代码块失效,并导致一个语法异常.其二:如果在运 ...
- 利用JAVA反射机制将JSON数据转换成JAVA对象
net.sf.json.JSONObject为我们提供了toBean方法用来转换为JAVA对象, 功能更为强大, 这里借鉴采用JDK的反射机制, 作为简单的辅助工具使用, 有些数据类型需要进行转 ...
- js 数组排序和算法排序
1.算法排序 a.插入排序 var arr = [23,34,3,4,23,44,333,444]; var arrShow = (function insertionSort(array){ if( ...
- (转)Linux下安装rar fou linux
在Linux下安装rar fou linux rar for linux 软件下载地址:http://www.rarsoft.com/download.htm 到目前为止最新的版本为4.10 beta ...
- android 入门 004 (同一个方法,点击实现不同的效果)
同一个方法,点击实现不同的效果 <Button android:id="@+id/btn3" android:layout_width="wrap_content& ...
- DataSet 关系
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...