You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Michiel Meeuwissen <Mi...@omroep.nl> on 2001/04/27 12:40:04 UTC

indexed property with a string

Perhaps a stupid question, but I'm rather new to taglibs and beans:

I think I can do:
<bean:write name="answernode" property="value[2]" />
where I have an 'indexed' property value. It is indexed with a int,
so it calls a method 'getValue(int)'.

Can I also have a property which is indexed with a string, which would
call 'getValue(String)' ?

 Michiel

-- 
Michiel Meeuwissen - NOS internet 
Mediacentrum kamer 203 - tel. +31 (0)35 6773065
http://www.mmbase.org  
http://www.purl.org/NET/mihxil/


Re: indexed property with a string

Posted by Michiel Meeuwissen <Mi...@omroep.nl>.
Michiel Meeuwissen <Mi...@omroep.nl> wrote:
> Can I also have a property which is indexed with a string, which would
> call 'getValue(String)' ?

And why not?

-- 
Michiel Meeuwissen - NOS internet 
Mediacentrum kamer 203 - tel. +31 (0)35 6773065
http://www.mmbase.org  
http://www.purl.org/NET/mihxil/


RE: indexed property with a string

Posted by Iraklis Kourtidis <ik...@covia.com>.
Hi Michiel,

this is not a stupid question. The answer unfortunately is that you can't
(as far as I know). This is causing us pain here in my company. For more
information, please follow the series of emails with the subject
"(architectural issue/feature request) JavaBeans in Struts aren't flexible
enough" (you can also find it at the mail archive at
http://www.mail-archive.com/struts-user@jakarta.apache.org

As far as the "why not?" question goes: my (educated) guess is that all that
Javabean stuff works through introspection, so when you specify property
"foo",there has to be a function called 'getFoo'.

hope this helps,
Iraklis



-----Original Message-----
From: Michiel Meeuwissen [mailto:Michiel.Meeuwissen@omroep.nl]
Sent: Friday, April 27, 2001 5:40 AM
To: struts-user@jakarta.apache.org
Subject: indexed property with a string


Perhaps a stupid question, but I'm rather new to taglibs and beans:

I think I can do:
<bean:write name="answernode" property="value[2]" />
where I have an 'indexed' property value. It is indexed with a int,
so it calls a method 'getValue(int)'.

Can I also have a property which is indexed with a string, which would
call 'getValue(String)' ?

 Michiel

--
Michiel Meeuwissen - NOS internet
Mediacentrum kamer 203 - tel. +31 (0)35 6773065
http://www.mmbase.org
http://www.purl.org/NET/mihxil/