struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alfredo Manuel Osorio Martinez" <alfredo.oso...@afirme.com>
Subject RE: Add a map to HttpRequest attributes
Date Wed, 19 Jan 2011 23:16:51 GMT
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


Mime
View raw message