Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

looping through form fields

Status
Not open for further replies.

owlface23

Programmer
Sep 3, 2002
5
0
0
GB
I am a complete JSP novice - I have a JSP page that form data is submitted to, and I want to loop through all of the form field names, e.g.

For each submitted form field

print form field name / value

Next

Can someone help me?

Thanks,

Owlface 8>
 
Hi!

You could try something like this (not tested):

Code:
Enumeration enum = request.getParameterNames();
String line = "";
while (enum.hasMoreElements()) {
    String paramName = (String)enum.nextElement();
    String[] values = request.getParameterValues(paramName);
    out.println("parameter name: " + paramName);
    for (int i = 0; i < values.length, i++) {
      out.println(&quot;values: &quot; + values[i]);
    }
}


Cheers

frag

patrick.metz@epost.de
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top