<form action="xx.html" method="post">
<input type=hidden name=content value="question1|item1|select1">
<input type=hidden name=content value="question2|item2|select2">
<input type=hidden name=content value="question3|item3|select3">
<input type=hidden name=content value="question4|item4|select4">
......
<input type=submit>
</form>
     传到 Action 
              String str[]=request.getParameterValues("content");//获得总选项
        for(int i=0;i<str.length;i++){
     //???? 这里怎么用split 怎么分解、分割   各位高手速速解答望
                            System.out.println("hao123:"+str[i]);        }
  

解决方案 »

  1.   

    content 名称都一样怎么获取?
    只能获取一个
      

  2.   

    String str[]=request.getParameterValues("content");//获得总选项
    for(int i=0;i<str.length;i++){
       String str2[] = str[i].split("|");
    }
      

  3.   

    把<input type=hidden name=content value="question1|item1|select1">
    写成  <input type=hidden name=content value="question1|item1*select1">
    在循环中
    String question = str[i].split("\\|")[0]
    String item = str[i].split("\\|")[1].split("\\*")[0]
    String select = str[i].split("\\|")[1].split("\\*")[1]
    这是个思路,你想下该如何往下写
      

  4.   

    我是想集成一个集合  一起获取  那如果把content 改为content1,content2,content3,......呢 又怎么做
      

  5.   


    String uuid []=content.split(",");
    for(int i=0;i<uuid.length;i++){
        .....................
    }
      

  6.   

    你已经把数组遍历了出来,每个值都是一个name ,name有什么好分割的,搞不懂了。
      

  7.   

     for(int i=0;i<str.length;i++){
        String str2[] = str[i].split("\\|");
         System.out.println("hao123:"+str[i]);
        System.out.println("-----------------------------------") ;
        for(int j = 0; j < str2.length; j++){
           System.out.println(str2[j]) ;
        }}
      

  8.   

    String str[]=request.getParameterValues("content");//获得总选项
    List<String[]> list = new ArrayList<String[]>();
    for(int i=0;i<str.length;i++){
      String s[] = str[i].split("|");
      list.add(s);
    }// 遍历list,在list循环中遍历string数组
      

  9.   

    比如: 如果 item、select也是一个集合呢,又怎么分拆