Get all parameters from JSP page

后端 未结 6 1358
无人共我
无人共我 2020-12-01 03:33

I have n number of text fields named in the form \"Question.....\". How can I get all the parameters which starts with \"question\" from the JSP page to the Action?

6条回答
  •  庸人自扰
    2020-12-01 04:27

    localhost:8080/esccapp/tst/submit.jsp?key=datr&key2=datr2&key3=datr3
    
        <%@page import="java.util.Enumeration"%>
    
        <%
        Enumeration in = request.getParameterNames();
        while(in.hasMoreElements()) {
         String paramName = in.nextElement().toString();
         out.println(paramName + " = " + request.getParameter(paramName)+"
    "); } %> key = datr key2 = datr2 key3 = datr3

提交回复
热议问题