You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Torgeir Veimo <to...@vertech.no> on 2002/04/04 14:15:09 UTC

mapped properties and jndi's Attributes

I would like to use mappend properties with jndi, but using

<bean:write name='entry' property='(cn)' />

doesn't work, since PropertyUtils chokes when not supplying anything 
before the opening parenthesis. Ideally a property of (string) would map 
to get(string), which is the getter method on Attributes.

I thought I could look into PeopertyUtils to support this, but the code 
is a bit hard to get into at first sight.

Has anyone thought of supporting get(String id) style properties in struts?

-- 
-Torgeir


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: mapped properties and jndi's Attributes

Posted by Torgeir Veimo <to...@vertech.no>.
Craig R. McClanahan wrote:
> 
> On Thu, 4 Apr 2002, Torgeir Veimo wrote:
> 
> 
>>Date: Thu, 04 Apr 2002 14:15:09 +0200
>>From: Torgeir Veimo <to...@vertech.no>
>>Reply-To: Struts Developers List <st...@jakarta.apache.org>
>>To: Struts Developers List <st...@jakarta.apache.org>
>>Subject: mapped properties and jndi's Attributes
>>
>>I would like to use mappend properties with jndi, but using
>>
>><bean:write name='entry' property='(cn)' />
>>
>>doesn't work, since PropertyUtils chokes when not supplying anything
>>before the opening parenthesis. Ideally a property of (string) would map
>>to get(string), which is the getter method on Attributes.
>>
>>I thought I could look into PeopertyUtils to support this, but the code
>>is a bit hard to get into at first sight.
>>
>>Has anyone thought of supporting get(String id) style properties in struts?
>>
> 
> 
> If you use DynaBean based beans, you can get pretty much the same effect
> by just using:
> 
>   <bean:write name='entry' property='cn'/>
> 
> because the underlying DynaBean property ends up being retrieved with:
> 
>   String cn = entry.get("cn");
> 
> (This works in the nightly builds and in Struts 1.1-b1 -- it uses the most
> recent commons-beanutils nightly builds as well.)

Well, but dynabeans must be declared in the struts-config file in 
advance, to my knowledge, so they aren't as dynamic as my ldap entries 
are. The above example works for java classes where

<bean:write name='entry' property='property(cn)'/>

translates to getProperty("cn"), just not for get("cn"). I thought this 
would be a very minor fix (tweak) to PropertyUtils, not an extension of 
the expression language.






-- 
-Torgeir


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: mapped properties and jndi's Attributes

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Thu, 4 Apr 2002, Torgeir Veimo wrote:

> Date: Thu, 04 Apr 2002 14:15:09 +0200
> From: Torgeir Veimo <to...@vertech.no>
> Reply-To: Struts Developers List <st...@jakarta.apache.org>
> To: Struts Developers List <st...@jakarta.apache.org>
> Subject: mapped properties and jndi's Attributes
>
> I would like to use mappend properties with jndi, but using
>
> <bean:write name='entry' property='(cn)' />
>
> doesn't work, since PropertyUtils chokes when not supplying anything
> before the opening parenthesis. Ideally a property of (string) would map
> to get(string), which is the getter method on Attributes.
>
> I thought I could look into PeopertyUtils to support this, but the code
> is a bit hard to get into at first sight.
>
> Has anyone thought of supporting get(String id) style properties in struts?
>

If you use DynaBean based beans, you can get pretty much the same effect
by just using:

  <bean:write name='entry' property='cn'/>

because the underlying DynaBean property ends up being retrieved with:

  String cn = entry.get("cn");

(This works in the nightly builds and in Struts 1.1-b1 -- it uses the most
recent commons-beanutils nightly builds as well.)

Over the longer term, I would strongly suggest that we *not* add any more
functionality to the proprietary "expression language" that Struts uses to
retrieve property values.  Instead, it's time to start migrating to the
expression language being used in the JSP Standard Tag Library
(http://jakarta.apache.org/taglibs/standard), which will also become part
of JSP 1.3.

> --
> -Torgeir
>

Craig


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>