You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Stefan Kleineikenscheidt <st...@kleineikenscheidt.de> on 2004/08/13 00:39:35 UTC

[Jelly] Define Beans

Hello,

I would like to create a bean, which has a complex property.  My Jelly
script looks something like that, but it doesn't work:

---%<------------------------------------

  <define:taglib uri="mytaglib">
    <define:jellybean
      name="beanA"
      className="package.name.BeanA"
      method="execute" />

    <define:bean
      name="beanB"
      className="package.name.BeanB" />
  </define:taglib>
  
  <goal name="hello"> 
  
    <mytaglib:beanB
        var="mybeanb" />
        
    <mytaglib:beanA
        var="myConverter"
        propertyOfTypeBeanB="mybeanb" />  **)
  ....

---%<------------------------------------

**) Jelly tries to set 'mybeanb' as String to 'propertyOfTypeBeanB',
which results in an IllegalArgumentException. 

Is there a way to do something like that with Jelly?

Thanks for any hint,
-Stefan




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


RE: [Jelly] Define Beans

Posted by Stefan Kleineikenscheidt <st...@kleineikenscheidt.de>.
Thanks, that did the trick!  :)

-Stefan



> -----Original Message-----
> From: Dion Gillard [mailto:dion.gillard@gmail.com] 
> Sent: Friday, August 13, 2004 2:01 AM
> To: Jakarta Commons Users List
> Subject: Re: [Jelly] Define Beans
> 
> 
> On Fri, 13 Aug 2004 00:39:35 +0200, Stefan Kleineikenscheidt
> <st...@kleineikenscheidt.de> wrote:
> > 
> > Hello,
> > 
> > I would like to create a bean, which has a complex 
> property.  My Jelly
> > script looks something like that, but it doesn't work:
> > 
> > ---%<------------------------------------
> > 
> >   <define:taglib uri="mytaglib">
> >     <define:jellybean
> >       name="beanA"
> >       className="package.name.BeanA"
> >       method="execute" />
> > 
> >     <define:bean
> >       name="beanB"
> >       className="package.name.BeanB" />
> >   </define:taglib>
> > 
> >   <goal name="hello">
> > 
> >     <mytaglib:beanB
> >         var="mybeanb" />
> > 
> >     <mytaglib:beanA
> >         var="myConverter"
> >         propertyOfTypeBeanB="mybeanb" />  **)
> >   ....
> > 
> > ---%<------------------------------------
> > 
> > **) Jelly tries to set 'mybeanb' as String to 'propertyOfTypeBeanB',
> > which results in an IllegalArgumentException.
> 
> And so it should.
> 
> Defining a bean as part of a taglib means that it will call the
> execute method when the tag is executing.
> 
> > Is there a way to do something like that with Jelly?
> If you'd like to create a bean, and store it in a property, the
> useBean tag 
> http://jakarta.apache.org/commons/jelly/tags.html#core:useBean

is more appropriate.

-- 
http://www.multitask.com.au/people/dion/

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


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


Re: [Jelly] Define Beans

Posted by Dion Gillard <di...@gmail.com>.
On Fri, 13 Aug 2004 00:39:35 +0200, Stefan Kleineikenscheidt
<st...@kleineikenscheidt.de> wrote:
> 
> Hello,
> 
> I would like to create a bean, which has a complex property.  My Jelly
> script looks something like that, but it doesn't work:
> 
> ---%<------------------------------------
> 
>   <define:taglib uri="mytaglib">
>     <define:jellybean
>       name="beanA"
>       className="package.name.BeanA"
>       method="execute" />
> 
>     <define:bean
>       name="beanB"
>       className="package.name.BeanB" />
>   </define:taglib>
> 
>   <goal name="hello">
> 
>     <mytaglib:beanB
>         var="mybeanb" />
> 
>     <mytaglib:beanA
>         var="myConverter"
>         propertyOfTypeBeanB="mybeanb" />  **)
>   ....
> 
> ---%<------------------------------------
> 
> **) Jelly tries to set 'mybeanb' as String to 'propertyOfTypeBeanB',
> which results in an IllegalArgumentException.

And so it should.

Defining a bean as part of a taglib means that it will call the
execute method when the tag is executing.

> Is there a way to do something like that with Jelly?
If you'd like to create a bean, and store it in a property, the
useBean tag http://jakarta.apache.org/commons/jelly/tags.html#core:useBean
is more appropriate.

-- 
http://www.multitask.com.au/people/dion/

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