> > -----Original Message-----
> > From: Darko [SMTP:[EMAIL PROTECTED]]
> >
> > How do I retrieve all the parameter names and/or values at once from an
> > html page ?
> > I have around 100 paramaters on my html page and when I call a servlet
> > to process them, I use following code to retrieve parameter names
> >
> > Enumeration enum = req.getParameterNames();
> > while (enum.hasMoreElements()) {
> > String name = (String) enum.nextElement();
> > out.println("name = "+i+" "+name);
> > i++;
> > out.println();
> >
> > But I get only about 30 parameter names, I dont know what happened with
> > the rest.
Mark Foley wrote:
>
> Could it be that yous have hit some sort of string length for the URL when
> sending the parameters from the browser to the server? From what I
> remember, the GET method has limitations which the POST method doesn't.
Yes there is a limit on the amount of data you can send with GET, but the
problem doesn't appear to be between GET and POST. If he's getting 30 parameter
names I would guess that he's well over the GET limit and so is probably using
POST.
My guess would be that the HTML form is using the same name for some parameters.
For example if the HTML form as a SELECT tag, there will be only 1 parameter
name but many parameter values (if the SELECT is MULTIPLE).
Darko, try the following:
Enumeration enum = req.getParameterNames();
while (enum.hasMoreElements()) {
String name = (String) enum.nextElement();
String[] values = req.getParameterValues(name);
for (int i = 0; i < values.length; i++) {
System.out.println("name: " + name + " value: " + values[i]);
}
}
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html