• 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;
     }

  • 相关阅读:
    ActiveMQ 中的链表
    ActiveMQ 的线程池
    ActiveMQ broker解析
    ActiveMQ broker和客户端之间的确认
    ActiveMQ producer 流量控制
    基于大数据的精准营销与应用场景
    Math.abs为Integer.Min_VALUE返回错误的值
    使用http_load网站压力测试
    可伸缩系统的架构经验
    Tumblr:150亿月浏览量背后的架构挑战
  • 原文地址:https://www.cnblogs.com/zfswff/p/3502505.html
Copyright © 2020-2023  润新知