You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Lucas Bern <lu...@yahoo.com.ar> on 2005/08/24 20:37:55 UTC

Tag that uses tags

Hi guys...

I need to do something like this:

x = new SomeTag();

x.setContext(this.getContext());

x.doStarTag();

x.DoBody();

...

etc...

I´m not sure the way i should do that, has anybody ben dealing wit this before??

 

Thanks

Lucas

__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis! 
¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar

Re: Tag that uses tags

Posted by Rahul Akolkar <ra...@gmail.com>.
On 8/24/05, Laurie Harper <la...@holoweb.net> wrote:
> Lucas Bern wrote:
> > Hi guys...
> >
> > I need to do something like this:
> >
> > x = new SomeTag();
> >
> > x.setContext(this.getContext());
> >
> > x.doStarTag();
> >
> > x.DoBody();
> >
> > ...
> >
> > etc...
> >
> > I´m not sure the way i should do that, has anybody ben dealing wit this before??
> 
> Why would you want to instantiate / invoke a tag manually? If you're doing
> it to re-use functionality in one tag from another, you should probably
> look at either moving the shared functionality into a helper class or using
> inheritance.
<snip/>

Or think JSP 2.0, think tag files (can you, or are you bound to 1.2 or
lower?). 2.0 gives more than one programming models for tag impls, and
IMO, Java has only so much joy when it comes to tag composition. As a
bonus, you won't have to write out.println's or escape double quotes
in case you're rendering via an XML variant markup (or HTML).

Does this help any? [
http://wiki.apache.org/jakarta-taglibs/ReusableDialogComponents/Tutorials/Composition
]

-Rahul

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


Re: Tag that uses tags

Posted by Laurie Harper <la...@holoweb.net>.
Lucas Bern wrote:
> Hi guys...
> 
> I need to do something like this:
> 
> x = new SomeTag();
> 
> x.setContext(this.getContext());
> 
> x.doStarTag();
> 
> x.DoBody();
> 
> ...
> 
> etc...
> 
> I´m not sure the way i should do that, has anybody ben dealing wit this before??

Why would you want to instantiate / invoke a tag manually? If you're doing 
it to re-use functionality in one tag from another, you should probably 
look at either moving the shared functionality into a helper class or using 
inheritance.

At any rate I'm not sure what's wrong with what you have above, it looks 
'reasonable' to me. What's the problem you're seeing?

L.
-- 
Laurie Harper
Open Source advocate, Java geek: http://www.holoweb.net/laurie
Founder, Zotech Software: http://www.zotechsoftware.com/


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