Hi Peter,

On Thu, Aug 27, 2009 at 12:41 PM, Peter Chiochetti<p...@myzel.net> wrote:
> I am very new to java servlet programming, and I like sling, because I do
> not have to become proficient in that area.

good ;-)

> ...I try to get at the values in a POSTed form within ESP, I came up with 
> this:
>
> <%
> var paramMap = request.getParameterMap();
> var paramIterator = paramMap.keySet().iterator();
> while(paramIterator.hasNext()) {
>        var name = paramIterator.next();
>        var value = paramMap.get(name);
>        out.print("Name: " + name + ", Value: " + value + "\n");
> }
> %>
>
> curl -F"test=1" -F"bar=foo" http://.../Some.json prints:
> Name: test, Value: [Ljava.lang.String;@1951a1d
> Name: bar, Value: [Ljava.lang.String;@1e5a654
>
> It does not help to print "String(value)" or value.toString() either.

That's because the result of request.getParameterMap() is a Map of
String to String [] (as per the javax.servlet.ServletRequest
interface), as parameters can have multiple values.

If you only want the first one, use value[0]

-Bertrand

Reply via email to