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

Peter A. Pilgrim peterp at xenonsoft.demon.co.uk
Sun Feb 9 18:00:48 PST 2003


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 );

And you simple access as property attribute like this.

	"myMappedProperty[first_name]"

e.g
	<bean:write name="someBean" property="myMappedProperty[first_name]" />

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; }

So can you write

	<c:out value="someBean.map['first_name']" />

or iterate through the entire map collection using

	<c:forEach var="item" collection="someBean.map" >..</forEach>


> 
>> I guess the guys who worked on the Expresso/Struts integration would 
>> have considered this?  Also, it would seem Expressoa nd Struts will be 
>> going down the JSTL road in the future.
>> Having come from a pure Struts background, I would also like to be 
>> able to use some of the Struts-compatible tag libraries (Ed Hill's 
>> display tag library 
>> (<http://edhill.its.uiowa.edu/display-0.8/>http://edhill.its.uiowa.edu/display-0.8/) 
>> is one I'm converting for Expresso at the moment).  It would be SOOOO 
>> nice to be able to use it 'off the shelf'!
> 
> 
> +1 There! :)
> 
>                                                 -Mike
> 
> 
> 
> _______________________________________________
> Opensource mailing list
> Opensource at jcorporate.com
> http://mail.jcorporate.com/mailman/listinfo/opensource
> Archives: http://mail.jcorporate.com/pipermail/opensource/
> 
> 


-- 
Peter Pilgrim
            __ _____ _____ _____
           / //__  // ___// ___/   +  Serverside Java
          / /___/ // /__ / /__     +  Struts
         / // ___// ___// ___/     +  Expresso Committer
      __/ // /__ / /__ / /__       +  Independent Contractor
     /___//____//____//____/       +  Intrinsic Motivation
On Line Resume
    ||
    \\===>  `` http://www.xenonsoft.demon.co.uk/no-it-striker.html ''




More information about the Opensource mailing list