The following reply was made to PR mod_jserv/4207; it has been noted by GNATS.
From: "Balagopal KP" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED], [EMAIL PROTECTED]
Cc: Subject: Re: mod_jserv/4207: getParameterValues not working in SSI
Date: Mon, 12 Apr 1999 14:37:18 PDT
Hi,
I think the getParameterValues wont work because the HashTable.put()
replaces the value everytime a new param value with the same name is
encountered,...
I changed JServSSI::parsePage() to have a vector of values for each
param..
the relevant change:
if (tag.isNamed("PARAM") && tag.isWellFormed()) {
// set parameter
String name = tag.value("NAME", null);
String value = tag.value("VALUE", null);
if (name != null && value != null) {
//Replacing params.put(name,value);
Vector valueVector;
if ((valueVector
=(Vector)params.get(name))== null)
{
valueVector = new Vector();
params.put(name,valueVector);
}
// replaced
valueVector.add(value);
//params.put(name,value);
}
and ServletInfoRequest::getParameter() as follows
public String getParameter(String name) {
//replacing this
//String value = (String) params.get(name);
//added this
Vector value = (Vector)params.get(name);
String rvalues[] = req.getParameterValues(name);
//modified this
return (value != null) ? (String)(value.firstElement()) :
(rvalues.length > 0 ? rvalues[0] : null);
}
and ServletInfoRequest::getParameterValues() as follows
public String[] getParameterValues(String name) {
String[] values = req.getParameterValues(name);
if (params.containsKey(name)) {
String[] these;
if (values != null) {
these = new String[values.length+1];
System.arraycopy(values, 0, these, 1, values.length);
//added this
these[0] = (String)params.get(name);
} else {
//removed this
//these = new String[1];
/added these
Vector tV = (Vector) params.get(name);
these = new String[ tV.size()];
these = (String [])tV.toArray(these);
//end
}
//removed this
//these[0] = (String)params.get(name);
values = these;
}
return values;
}
while this works for me, it is not probably the best way to do it,
thanks
bala
_______________________________________________________________
Get Free Email and Do More On The Web. Visit http://www.msn.com