If you are doing something like this please note the method:

http://download.oracle.com/docs/cd/E17802_01/products/products/servlet/2.3/javadoc/javax/servlet/ServletRequest.html#getParameterMap()

This will return an array of Strings rather than a single string in
the returned Map, is this because you can submit multiple values with
the name parameter name in HTTP.

regards Malcolm Edgar

On Mon, Aug 15, 2011 at 5:38 PM, Nicholas Dierauf
<[email protected]> wrote:
> Hello,
>
>
>
> I am trying to populate form fields from an HttpServletRequest parameter map
> using Form.copyFrom(map). I am finding that all but HiddenField(s) are
> getting populated. For the HiddenField, an IllegalArguementException is
> getting thrown:
>
>
>
> java.lang.IllegalArgumentException: The value.getClass():
> '[Ljava.lang.String;' must be the same as the HiddenField valueClass:
> 'java.lang.String'
>
>       at
> org.apache.click.control.HiddenField.setValueObject(HiddenField.java:243)
>
>       at
> org.apache.click.util.ContainerUtils.copyMapToFields(ContainerUtils.java:1100)
>
> ...
>
>
>
> The HiddenField is different from other fields in that it uses a
> ‘valueObject’ rather than a value String. I’ve tried setting the valueObject
> in the HiddenField constructor to match the String array that is used in the
> parameter map, but with no luck. I even tried creating my own HiddenField
> class, but the Form class still creates Click HiddenField(s) (for example
> for passing the form name), which throws the exception during copyFrom.
>
>
>
> Does anybody have any suggestions/insights/work-arounds for this? I would
> love to leverage this useful method for populating form fields from a
> servlet request. I’m using Apache Click 2.3.0.
>
>
>
> Thank you,
>
> Nick.
>
>
>
>

Reply via email to