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.oso...@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:dsevan...@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-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org