[Opensource] why aren't ControllerElements exposed as beans to jsps?

Michael Rimov rimovm at centercomp.com
Mon Feb 10 14:41:06 PST 2003


At 02:00 AM 2/10/2003 +0000, you wrote:
>Michael Rimov wrote:
>>At 11:24 AM 2/7/2003 +0000, you wrote:
>>
>>>As you no doubt know, Struts relies on introspection, so a bean would 
>>>require matching getter methods for the 'name' and/or 'property'a 
>>>ttributes of the Struts tags.  I guess providing a few additional 
>>>methods on ControllerElement would overcome this, though I could be 
>>>oversimplifyingt hings here :).
>>
>>Actually, I don't think you're oversimplifying.  In fact, applying JSTL 
>>to controllerResponse only proved your point to me this last release.
>>However, I wanted to ask the group how Struts deals with 'mapped' 
>>properties.  I believe mapped is the proper term :)... I remember that 
>>the Struts folks were going to have to expose additional methods because 
>>JSTL didn't cope with mapped properties, but Struts did.... so for all 
>>you Struts wizzes:  How do you write a struts expression to get a Mapped 
>>property?  By mapped I mean:
>>                         Object getMyMappedProperty(Object key);
>>If we know this, then raw struts tags should work with ControllerResponse 
>>straight (or is this only a feature of Struts 1.1??)
>
>Actually I think the correct signature should be, if I remember
>the Commons Bean-Utils documentation rightly.
>
>
>         Object getMyMappedProperty( String key );
>         void   setMyMappedProperty( String key, Object newValue );

Yes, that is correct.  Thanks :)


>And you simple access as property attribute like this.
>
>         "myMappedProperty[first_name]"
>
>e.g
>         <bean:write name="someBean" 
> property="myMappedProperty[first_name]" />

So Pete.... Based upon these discussions, couldn't the struts tags work 
directly with Expresso without any extensions??  I haven't tried it yet 
personally, but I'm getting the urge to given what we're finding :)

>With JSTL you have to expose a Map Collection as a property in your
>  Java Bean for this to work. This is easy to write.
>
>         private map = new HashMap();
>         public Map getMap() {  return map; }

And it is already done in 5.0.3

Thanks for the input!
                                                 -Mike





More information about the Opensource mailing list