Hi Vinh,
I have already defined that and am getting a row which is a hashmap composed
of columns and values for eg "nameId" is a column within this hashmap
row.This same concept is used in *result* I think in JSTL.
<logic:iterate id="hashMapQuestionRow" name="ac"
property="hashMapQuestionRows" >

I want to access a particular named key like
hashMapQuestionRow.get("nameId") within that hashMap using some tag and the
use it for eg in:
<input type="hidden" name="questionIDs" value="<bean:write
name="nameId" />">

What I really want to do is this or something like this:
<bean:write name="hashMapQuestionRow" key="nameId" />

Thanx,
Vijay




-----Original Message-----
From: Vinh Tran [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 04, 2002 12:55 PM
To: Struts Users Mailing List
Subject: RE: get key value for a hashmap row-similar to result in jstl


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]>

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

Reply via email to