Order of request.getParameterNames()

后端 未结 5 1033
无人共我
无人共我 2021-01-04 04:36

How do I get all the parameterNames in an HTML form in the same sequence as they are in the form.

i.e if the form contains .... FirstName, LastName, MiddleName and

5条回答
  •  别那么骄傲
    2021-01-04 04:49

    HTML or Jsp Page

    
    
    
    
    

    and so on...

    then in java code

    SortedSet ss = new TreeSet();
    Enumeration enm=request.getParameterNames();
    while(enm.hasMoreElements()){
        String pname = enm.nextElement();
        ss.add(pname);
    }
    Iterator i=ss.iterator();
    while(i.hasNext()) {
        String param=(String)i.next();
        String value=request.getParameter(param);
    }
    

提交回复
热议问题