tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lukas Bradley" <lu...@somnia.com>
Subject Re: TagExtraInfo on getVariableInfo() - can't get parent information?
Date Fri, 03 Oct 2003 15:36:23 GMT
Thank you for the quick reply, Martin.  You're always very helpful.

I'm attempting to utilize the TagExtraInfo object to automatically create a
translation-time variable for me.  The getVariableInfo() method would look
something like this:

public VariableInfo[] getVariableInfo(TagData pTagData)
{
   VariableInfo [] infoArray = null ;
   infoArray = new VariableInfo[1] ;
   infoArray[0] = new VariableInfo(myName, myType, true,
VariableInfo.NESTED) ;
}

To use my previous example, this would be easy within the <my:tag>.
However, I want the myName and myType variables defined in the <my:tag>
attribute list, BUT the actual translation-time variable created within an
inner-child tag <my:inner-loop>.  To be more specific, my inner-loop tag
would have a TEI using the method above, not the parent tag.

As of now, I see no way that a child tag's TagExtraInfo to retrieve parent
TagData attribute information. If the TagExtraInfo object had access to the
Tag.getParent() method (or the  findAncestorWithClass( ) method as you
noted), this wouldn't be a problem.  (As a side-conversation, I'm starting
to wonder why the TagExtraInfo design is de-coupled from the tag-class
itself.)

I hope this clears up my question.

Lukas


"Martin van Dijken" <mvdijken@madocke.nl> wrote in message
news:61BAD406AA642745AE1142AF689E8D8E217A6D@madocontrol.madocke.local...
> Hey Lukas,
>
> I'm not entirely certain what you're asking. Do you want to know how to
pass info from the tag to the inner-loop? If you're programming the
inner-loop tag yourself, you can simply do a findAncestorWithClass(this,
MyTag.class) in the innerloop class. This presents you with the instance of
the parent whom you can query for the information that was given to it.
>
> If not, please clarify your problem a little further.
>
> Grtz,
>
> Martin
>
> > -----Original Message-----
> > From: Lukas Bradley [mailto:lukas@somnia.com]
> > Sent: vrijdag 3 oktober 2003 16:43
> > To: taglibs-user@jakarta.apache.org
> > Subject: TagExtraInfo on getVariableInfo() - can't get parent
> > information?
> >
> >
> > Hi all, I want to do this:
> >
> > <my:tag array="myArray" var="myName" type="mycompany.MyObjectType">
> >    <my:header>
> >       ...
> >    </my:header>
> >
> >    <my:inner-loop> <%-- LOOP PERFORMED HERE --%>
> >       ...
> >    </my:inner-loop>
> > </my:tag>
> >
> > Where the object, a translation-time variable name, and
> > object type are
> > defined in a parent tag, and the actual loop is performed
> > within a child
> > tag.   In the example above, my:tag references the array and the
> > translation-time information.  The my:inner-loop tag will
> > iterate over the
> > array after certain header information is displayed.
> >
> > I'm sure some of you are asking, why not do this?
> >
> > <my:tag>
> >    <my:header>
> >       ...
> >    </my:header>
> >
> >    <my:inner-loop array="myArray" var="myName"
> > type="mycompany.MyObjectType">
> >    </my:inner-loop>
> > </my:tag>
> >
> > Please assume there are other things going on within these
> > tags, and it
> > helps with readability if the array is declared within the parent.
> >
> > So-- the TagExtraInfo class, its getVariableInfo() method,
> > and the TagData
> > object are all ignorant to the parent information.  Is there
> > a way around
> > this?  I'm presently using J2EE 1.3.1, but the 1.4b2 API offers no new
> > features.
> >
> > Thanks for any and all help.
> >
> > Lukas
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
> >
> >




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


Mime
View raw message