struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Hardy <ahardy.str...@cyberspaceroad.com>
Subject Re: HashMap of Vectors and Indexed Properies
Date Mon, 05 Apr 2004 06:52:35 GMT
Yes, and the website's now at http://struts.apache.org

On 04/05/2004 02:09 AM Craig Tataryn wrote:
> Thanks, I'll check that out.  Hey, did the mailing list address change or something?
 I've always
> mailed to struts-user@jakarta.apache.org and now I see the reply-to generated by the
list manager is
> now  user@struts.apache.org.
> 
> Craig
> 
> 
> On Sun, 04 Apr 2004 23:05:42 +0200, Adam Hardy wrote:
> 
> 
>>Craig,
>>why don't you use the nested:text tag and iterate over the 
>>address(texas) property?
>>
>>Adam
>>
>>On 04/04/2004 11:02 PM Craig Tataryn wrote:
>>
>>>Just realized I missprinted something, my code now looks like:
>>>
>>><html:text name="myForm" property="address(texas).element[0].street1"/>
>>>not
>>><html:text name="myForm" property="address(texas).getElement[0].street1"/>
>>>as the "get" is not needed.
>>>
>>>But again, let me know if anyone has any ideas on how I can get this working without
subclassing
>>>Vector.
>>>
>>>Thanks,
>>>
>>>Craig.
>>></tataryn:craig>
>>>
>>>On Sun, 04 Apr 2004 15:41:37 -0500 (CDT), "Craig Tataryn" wrote:
>>>
>>>
>>>
>>>>I have a property on my form bean I setup to work with Map-backed properties.
 Basically the hash
>>>>map backing the property is keyed by region and contains an Address object
representing a
> 
> company's
> 
>>>>office within that region.
>>>>
>>>>So something like:
>>>>
>>>><html:text name="myForm" property="address(texas).street1"/> would correctly
render the
>>>
>>>getStreet1()
>>>
>>>
>>>>property of my address object which was in the hash slot for the region "texas".
>>>>
>>>>Requirements have changed in our project and now we must support multiple
addresses for a company
>>>>within a region.  So I converted my hash map to hold a Vector of addresses
instead of a single
>>>>address per region.  I changed my jsp accordingly:
>>>>
>>>><html:text name="myForm" property="address(texas)[0].street1"/> however
that didn't work I get an
>>>>error, this (in my mind) should grab me the first address within vector of
adresses pointed to in
>>>>the texas slot and display the street1 property.
>>>>
>>>>Since my underlying value being passed back by address(texas) is a Vector,
I decided to try:
>>>>
>>>><html:text name="myForm" property="address(texas).get[0].street1"/>.
 That doesn't work either
>>>>because the only "true" prorperties for Vector are getClass(), getSize() and
isEmpty().  If the
>>>>"get" method on Vector was named "getElement" or something, I could get it
to work via:
>>>>
>>>><html:text name="myForm" property="address(texas).getElement[0].street1"/>.
 Until I find the
>>>>correct answer, I'm going to have to subclass Vector and add this new getElement(int)
method just
>>>
>>>so
>>>
>>>
>>>>I can get this to work.
>>>>
>>>>Has anyone else gotten a similar scenario to work using the existing PropertyUtils
syntax for
>>>
>>>naming
>>>
>>>
>>>>nested/indexed/mapped properties?  Is subclassing Vector the only way to go
here?
>>>>
>>>>Thanks,
>>>>
>>>>Craig
>>>></tataryn:craig>
>>>>
>>>><tataryn:craig/>
>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>><tataryn:craig/>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>
>>
>>-- 
>>struts 1.2 + tomcat 5.0.19 + java 1.4.2
>>Linux 2.4.20 Debian
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> <tataryn:craig/>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


-- 
struts 1.2 + tomcat 5.0.19 + java 1.4.2
Linux 2.4.20 Debian


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


Mime
View raw message