tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Justin Kennedy" <just...@maritimesource.ca>
Subject RE: tag reuse, setParent and findAncestorWithClass
Date Tue, 07 Sep 2004 13:01:54 GMT
Hi Tim,

I read through the link you posted but I don't see any references to
setParent. I understand that setParent is only called once when the
attributes for a tag are the same (because it's reused), so how should I
go about developing the inner tag so the parent will always be set? I
read up on SimpleTag and that could be the answer, but I'm worried about
performance with this because the writevalue tag is called many many
times on one page.

Thanksk

-----Original Message-----
From: Tim Funk [mailto:funkman@joedog.org] 
Sent: Tuesday, September 07, 2004 7:59 AM
To: Tomcat Users List
Subject: Re: tag reuse, setParent and findAncestorWithClass

http://jakarta.apache.org/tomcat/faq/misc.html#tagbroken

-tim

Justin Kennedy wrote:
> Hi,
> 
>  
> 
> I'm upgrading our tag library to Tomcat 5 and having problems. Note
that
> they were written back in JSP 1.1 and haven't changed for a few years.
> 
>  
> 
> The problem looks like the tags are being cached and the setParent
isn't
> being called for each new "reuse". As a result the wrong tag is
returned
> from findAncestorWithClass when the WriteValueTag is re-used in a
> different nested block. Maybe this is how the spec was designed and I
> just don't know the right way to code the tags. Anyway here's what the
> JSP page looks like (note: transacttag issues a call to the database.
> Writevaluetag writes the value of a column from the data returned from
> transacttag. If 'transactId' isn't passed to WriteValueTag, it will
use
> the findAncestorWithClass to find the enclosing IterateTag to
determine
> the transactId):
> 
>  
> 
> <trans:transact id="uis" action="main_uis"/>
> 
> <logic:iterate transactId="uis" column="uiid">
> 
>   <logic:equal value='<%=tmpuiid%>' column="uiid">
> 
>     a - <trans:writeValue column="UI_NAME" /><br>
> 
>     <trans:parameters id="params" scope="request">
> 
>         <trans:addParameter parametersId="params" key="UIID"
value='<%=
> tmpuiid %>'/>
> 
>     </trans:parameters>
> 
>     <trans:transact id="ui" action="sub_uis" parametersId="params" /> 
> 
>         <logic:exists transactId="ui" column="description">
> 
>             <logic:iterate transactId="ui" column="ui_flowid">
> 
>                 #1 - <trans:writeValue column="UI_NAME" /><br>
> 
>                 #2 - <trans:writeValue transactId="ui"
> column="FORM_NAME"/><br>
> 
>                 #3 - <trans:writeValue column="FORM_NAME"/><br>
> 
>             </logic:iterate>
> 
>         </logic:exists>
> 
>   </logic:equal>
> 
> </logic:iterate>
> 
>  
> 
>  
> 
> The problems:
> 
> 1.	UI_NAME in #1 is a column from the first "uis" transactTag. The
> writeValueTag prints out the value of this column but it shouldn't
> behave this way because it's enclosed IterateTag has a different
> "transactId". I put this here to demonstrate the problem
> 2.	FORM_NAME in #3 is a column in the second transactTag of "ui".
> This column value SHOULD be output (like it has always done) because
the
> enclosed iterateTag specifies the proper transactId, but this value is
> not output because it's parent is set to the first IterateTag and not
> the second, hence the different transactIds.
> 
>  
> 
> #2 works only because I'm explicitly setting the transactId. 
> 
>  
> 
> The WriteValueTag extends the TagSupport class and everything is done
in
> the doStartTag event.
> 
>  

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




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


Mime
View raw message