struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff_Mycha...@nlgroup.ca
Subject RE: Hashmap and logic:equal
Date Tue, 27 Aug 2002 16:44:02 GMT

"I think with Hashmap you just need key or value, so where you have
property="mapkey1" change to key or value"


I am a bit confused ,I will clarify..
Aa an eample, in my loadAction:
Map myMap = new Map();
myMap.put("item1","X");
myMap.put("item2","Y");
request.setAttrite("infoObject",myMap);


In my Page:
<logic:equals name="infoObject" property="item1????" value="X > Show A
</logic:equals>

Can this even by done?  I was hoping not to have to use a scriptlet or
iterate.

Thanks




Darryl Nortje <DarrylN@astrolabegroup.com> on 08/27/2002 11:18:50 AM

Please respond to "Struts Users Mailing List"
       <struts-user@jakarta.apache.org>

To:    'Struts Users Mailing List' <struts-user@jakarta.apache.org>
cc:

Subject:    RE: Hashmap and logic:equal


This is how I got it of my form object
<logic:equal name="defaultForm" property="jspAction" scope="request"
value="indexDoc">

and this is how I got it out of a collection object
<logic:iterate name="attrib" id="collElem">
 <logic:equal name="collElem" property="isReadonly" value="readonly">

In the form object I have a getJspAction() method and in the collection
object I have a getIsReadonly() method.

I think with Hashmap you just need key or value, so where you have
property="mapkey1" change to key or value

-----Original Message-----
From: Jeff_Mychasiw@nlgroup.ca [mailto:Jeff_Mychasiw@nlgroup.ca]
Sent: Tuesday, August 27, 2002 6:10 PM
To: struts-user@jakarta.apache.org
Subject: Hashmap and logic:equal


I am hoping that someone could point me in the right direction.
 I have been searching the archives and have not come accross anything that
I can relate to.

Using the equal tags, what is the best way to compare a value retieved from
a Hashmap?

I would like to put a Hashmap (or similar)  into request scope and use the
logic:equals tag. and do something like this.

<logic:equals name="mapName" property="mapkey1" value="<%= Constant.value
%>" > Show A </logic:equals>
<logic:equals name="mapName" property="mapkey2" value="<%= Constant.value
%>" > Show B </logic:equals>
<logic:equals name="mapName" property="mapkey3" value="<%= Constant.value
%>" > Show C </logic:equals>

Do I need to wrap this in simple class?
The docs make reference to the support of indexed properties, is there a
way to get the tag to look up the name of the key?


Thanks All



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

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








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


Mime
View raw message