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的更多相关文章

  1. jquery ajax传递数组给php

    写成:var data = {'item[]':item}; $.post(url,data,function(return_data) 写成item:item会导致数据缺失. 更多:http://w ...

  2. Go语言学习笔记(三)数组 & 切片 & map

    加 Golang学习 QQ群共同学习进步成家立业工作 ^-^ 群号:96933959 数组 Arrays 数组是同一种数据类型的固定长度的序列. 数组是值类型,因此改变副本的值,不会改变本身的值: 当 ...

  3. Restful传递数组参数的两种方式

    第一种,直接传递数组 js直接传递数组 var data = ["123","456"];that.loadDictionarys(data).subscrib ...

  4. springMVC通过ajax传递参数list对象或传递数组对象到后台

    springMVC通过ajax传递参数list对象或传递数组对象到后台 环境: 前台传递参数到后台 前台使用ajax 后台使用springMVC 传递的参数是N多个对象 JSON对象和JSON字符串 ...

  5. JavaScript 数组函数 map()

    JavaScript 数组函数 map() 学习心得 map()函数是一个数组函数: 它对数组每个原素进行操作,不对空数组进行操作: 不改变原本的数组,返回新数组: arr.map(function( ...

  6. 前端AJAX传递数组给Springmvc接收处理

    前端传递数组后端(Spring)来接收并处理: <!DOCTYPE html> <html> <head> <meta charset="UTF-8 ...

  7. 在ASP.NET MVC中以post方式传递数组参数的示例

    最近在工作中用到了在ASP.NET MVC中以post方式传递数组参数的情况,记录下来,以供参考. 一.准备参数对象 在本例中,我会传递两个数组参数:一个字符串数组,一个自定义对象数组.这个自定义对象 ...

  8. jquery ajax post 传递数组 ,多checkbox 取值

    jquery ajax post 传递数组 ,多checkbox 取值 http://w8700569.iteye.com/blog/1954396 使用$.each(function(){});可以 ...

  9. Jquery post 传递数组给asp.net mvc方法

    以批量删除数据为例  做批量删除会需要传递要删除的数据ID数组 function RemoveLog(){ var postModel=[]; //遍历复选框获取要删除的数据ID 存放到数组中  $( ...

随机推荐

  1. 在CentOS之上搭建VMware Player 7

    1.下载VMware-Player-7.1.2安装包 百度网盘下载地址: 链接:http://pan.baidu.com/s/1nudfo6H 密码:oemc 直接下载地址: https://down ...

  2. symfony中twig的模板载入

    模板 载入模板 {% include ‘sidebar.html’ %} 当前模板的变量也会传递到 被include的模板里,在那里面可以直接访问你这个模板的变量. {% for comment in ...

  3. 使用Symfony 2在三小时内开发一个寻人平台

    简介 Symfony2是一个基于PHP语言的Web开发框架,有着开发速度快.性能高等特点.但Symfony2的学习曲线也比 较陡峭,没有经验的初学者往往需要一些练习才能掌握其特性. 本文通过一个快速开 ...

  4. 使用radioGroup的时候,每个radioButton的状态选择器要使用 state_checked=""属性,不能使用selected

    使用radioGroup的时候,每个radioButton的状态选择器要使用 state_checked=""属性,不能使用selected

  5. HDU:Integer Inquiry

    #include"stdio.h" #include"stdlib.h" #include"string.h" #define N 105 ...

  6. 【20160924】GOCVHelper 图像增强部分(2)

       //填充孔洞     //fillholes     Mat fillHoles(Mat src){         Mat dst = getInnerHoles(src);          ...

  7. spring Aop中aop:advisor 与 aop:aspect的区别

    转载:http://blog.csdn.net/u011710466/article/details/52888277 在spring的配置中,会用到这两个标签.那么他们的区别是什么呢?       ...

  8. uml中定义的关系详细详解

    uml定义的关系主要有六种:依赖.类属.关联.实现.聚合和组合.下面对其定义和表示方法逐一说明. 依赖(Dependency):元素A的变化会影响元素B,但反之不成立,那么B和A的关系是依赖关系,B依 ...

  9. 2016年11月21日 星期一 --出埃及记 Exodus 20:12

    2016年11月21日 星期一 --出埃及记 Exodus 20:12 "Honor your father and your mother, so that you may live lo ...

  10. 2016年11月7日 星期一 --出埃及记 Exodus 19:23

    2016年11月7日 星期一 --出埃及记 Exodus 19:23 Moses said to the LORD, "The people cannot come up Mount Sin ...