struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Evans <dsevan...@gmail.com>
Subject Re: Add a map to HttpRequest attributes
Date Fri, 21 Jan 2011 01:06:43 GMT
Yes, that's what I've done, I was just thinking that it was a common
operation and maybe there was a util built in to the frameworks I'm
already using.

On Wed, Jan 19, 2011 at 3:16 PM, Alfredo Manuel Osorio Martinez
<alfredo.osorio@afirme.com> wrote:
> What about iterating the map and put each attribute in the HttpRequest.
>
> Something like this:
>        Map<String, Object> myMap = getMyMap();
>        Set<Map.Entry<String, Object>> entrySet = myMap.entrySet();
>        for (Map.Entry<String, Object> entry : myMap.entrySet()) {
>                request.setAttribute(entry.getKey(), entry.getValue());
>        }
>
> Alfredo Osorio
>
> -----Mensaje original-----
> De: Dave Evans [mailto:dsevans93@gmail.com]
> Enviado el: Wednesday, January 19, 2011 4:21 PM
> Para: Struts Users Mailing List
> Asunto: Add a map to HttpRequest attributes
>
> Hello,
>
> I have a business layer method that returns a map of objects. I would
> like to put all of the keys and values of this map into the request
> attribute map, like this:
> HttpRequest.putAll(map);
> This of course doesn't work, as the request isn't a map and the
> attributes map isn't available as a map.
>
> Are there any Struts or Apache commons utils that will do this?
>
> Thanks,
>
> Dave
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message