tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Justin Kennedy" <just...@maritimesource.ca>
Subject tag reuse, setParent and findAncestorWithClass
Date Tue, 07 Sep 2004 05:57:51 GMT
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.

 

Please advise,

-Justin

 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message