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. SQLServer学习笔记<>相关子查询及复杂查询

    二.查询缺少值的查询 在这里我们加入要查询2008年每一天的订单有多少?首先我们可以查询下订单表的订单日期在2008年的所有订单信息. 1 select distinct orderdate,coun ...

  2. window下appserv组合包配置asp标记风格与简短风格

    php一共有四种编码风格 分别为 :XML风格,脚本分铬,简短风格,ASP风格 如果要配置asp标记风格与简短风格,需要在php.ini文件中配置. 打开文件的位置C:\ window\php.ini ...

  3. jquery 操作select 语句大全

    jquery  select操作大全   添加option $("#ID option").each(function(){ ){ $(this).remove(); } }); ...

  4. 从invoke简单理解反射

    前言 程序集   : 程序集是.NET应用程序的基本单位,包含了程序的资源.类型元数据和MSIL代码.根据程序集生成方式的不同,可分为静态程序集和动态程序集.程序集又可分为单文件程序集和多文件程序集, ...

  5. FTP操作类

    using System; using System.Collections.Generic; using System.Net; using System.IO; namespace HGFTP { ...

  6. Linux内存模型

    http://blog.csdn.net/sunyubo458/article/details/6090946 了解linux的内存模型,或许不能让你大幅度提高编程能力,但是作为一个基本知识点应该熟悉 ...

  7. ural 1109,NYOJ 239,匈牙利算法邻接表

    NYOJ 239:http://acm.nyist.net/JudgeOnline/problem.php?pid=239 ural 1109 :http://acm.timus.ru/problem ...

  8. 2016年省赛G题, Parenthesis

    Problem G: Parenthesis Time Limit: 5 Sec  Memory Limit: 128 MBSubmit: 398  Solved: 75[Submit][Status ...

  9. Android任务和返回栈完全解析

    转载请注明出处:http://blog.csdn.net/guolin_blog/article/details/41087993 本篇文章主要内容来自于Android Doc,我翻译之后又做了些加工 ...

  10. SqlSever基础 有over函数时,用as为新列起名

    镇场诗:---大梦谁觉,水月中建博客.百千磨难,才知世事无常.---今持佛语,技术无量愿学.愿尽所学,铸一良心博客.------------------------------------------ ...