struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "S├ębastien LABEY" <sebastien.la...@gmail.com>
Subject Re: [S2] ServletRequestInterceptor & ParameterAware
Date Fri, 05 Jan 2007 07:59:48 GMT
Right, request parameters are String/value pairs, but because Struts2 can
convert these parameters to the right type through the getters/setters
described in the action, I was wondering if this could be possible to do the
same for the Map of parameters that I get through getParameters(). In this
case, getFoo() and getParameters().get("foo") would return a value with the
same type, that is not always a String.
I'm using the parameters from this Map to build (in a generic action)
another Map of the criteria that I send to the business part of the
application. It's very much easy to convert from this Map (if the objects
inside are typed and not only String) to my criteria than using bean
introspection to get the parameters one by one.
So does someone know if it is possible that the getParameters() Map contains
typed values?

Thanks very much in advance.



On 1/4/07, Dave Newton <DNewton@hibbertgroup.com> wrote:
>
> From: S├ębastien LABEY [mailto:sebastien.labey@gmail.com]
> > I know that getParameters().get("myParamater") returns an array of
> > objects,
> > but isn't it supposed to return not only String[], but arrays of
> > Objects
> > depending on the type described (if described) for the parameter
> > through
> > getter and setter in the action : if getId() returns an Integer, why
> > doesn't
> > getParameters().get("id") return an array of Integer, instead of an
> > array of
> > String?
>
> I thought that getParameters() via ParameterAware was just a wrapper
> around the request parameters, which are always name/value string pairs.
>
> I could be wrong, though; I'm well over par for stupid mistakes today.
>
> Dave
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message