You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by Zoran Ibrahimpasic <zi...@linuxfreak.com> on 1999/12/06 23:11:10 UTC

mod_jserv/5430: ServletRequest.getParameterValues(String) returns only one value

>Number:         5430
>Category:       mod_jserv
>Synopsis:       ServletRequest.getParameterValues(String) returns only one value
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    jserv
>State:          open
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Mon Dec  6 14:20:01 PST 1999
>Last-Modified:
>Originator:     zibrahimpasic@linuxfreak.com
>Organization:
apache
>Release:        Apache 1.3.9 JServ 1.1b2 (rpm)
>Environment:
Mandrake 6.1, Blackdown.org jdk 1.1.7
>Description:
ServletRequest.getParameterValues(String) returns only one value, even when
multiple values for the parameter are suplied.
It was working with 1.0 release.
I did't test it with 1.1b3, but I coudn't find nothing about that in changelog.
>How-To-Repeat:
You can test it with this servlet:

http://localhost/servlet/TestForm?v=1&v=2&v=3

public class TestForm extends HttpServlet
{ 

    public void doGet (HttpServletRequest request,
                       HttpServletResponse response) 
        throws ServletException, IOException
    {
	PrintWriter out;

	// set content type and other response header fields first
	response.setContentType("text/html");

	// then write the data of the response
	out = response.getWriter();

	Enumeration enum = request.getParameterNames();
	while (enum.hasMoreElements()) {
	    String name = (String)enum.nextElement();
	    String values[] = request.getParameterValues(name);
	    if (values != null) {
		out.println(values.length + "<BR>\n");
		for (int i=0; i<values.length; i++) {
		    out.println(name + " (" + i + "): " + values[i] + "<BR>\n");
		}
	    }
	}

	out.close();
    }

}
>Fix:

>Audit-Trail:
>Unformatted:
[In order for any reply to be added to the PR database, you need]
[to include <ap...@Apache.Org> in the Cc line and make sure the]
[subject line starts with the report component and number, with ]
[or without any 'Re:' prefixes (such as "general/1098:" or      ]
["Re: general/1098:").  If the subject doesn't match this       ]
[pattern, your message will be misfiled and ignored.  The       ]
["apbugs" address is not added to the Cc line of messages from  ]
[the database automatically because of the potential for mail   ]
[loops.  If you do not include this Cc, your reply may be ig-   ]
[nored unless you are responding to an explicit request from a  ]
[developer.  Reply only with text; DO NOT SEND ATTACHMENTS!     ]