Another option is to add some supporting fields to retrieve a
hashMapQuestionRow by key. For example:

class hashMapQuestionRows
{
        private String currentKey;
        private hashMapQuestionRow currentQuestionRow;

        ....

        public getHashMapQuestionRow()
        {
                return (hashMapQuestionRow)yourMap.get(currentKey);
        }

}

Have getters and setters for both.  Do a <jsp:setProperty> on currentKey
than do a <bean:define> for currentQuestionRow. I don't know if this
approach defies any "rules" but it works well for my requirements. The nice
thing is that you no longer need to iterate over the entire collection
looking for the requested nameId row.

Vinh

-----Original Message-----
From: Vijay Balakrishnan [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 04, 2002 3:33 PM
To: '[EMAIL PROTECTED]'
Subject: get key value for a hashmap row-similar to result in jstl


HI,

I am trying to get the key values for a hashmap row from a collection of
hashmaps.I want to access the specific key value from the hashmap eg:
I want to access the key value "nameId" from the hashMapQuestionRow
directly.How can i do that ? I am doing it this way right now.Is there an
easier way to do it.

<logic:iterate id="hashMapQuestionRow" name="ac"
property="hashMapQuestionRows" >
           <% int count=0;%>
            <logic:iterate id="item" name="hashMapQuestionRow">

                <logic:equal value="nameId" property="key" name="item" >
                    <%--<bean:write name="item" property="value" /> --%>

                    <bean:define id="nameId" name="item" property="value" />
                </logic:equal>
        </logic:iterate>

         <input type="hidden" name="questionIDs" value="<bean:write
name="nameId" />">

</logic:iterate>

Thanx,
Vijay

--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to