tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lds <...@nuix.com.au>
Subject BUG/FIX NEEDED: The Jasper2 bug with handling includes/custom tags.
Date Thu, 12 Sep 2002 02:30:44 GMT
Hi,

While trying to upgrate the tomcat version to 4.1.10 I found the following problem with the
Jasper2 jsp compiler. 

The Jasper's compiler produces the invalid code 
(that can't be compiled due to the invalid variable declarations) 
in case there are includes inside some custom tags. 
In particular the problem occures with the Struts's logic:iterate tag that contains the nested
include directive.

There are two fragments(extracts from the real JSP files) that caused this problem.

(1) The toplevel JSP that includes the another one.

toplevel.jsp
...
... 
<table class="formTable" cellpadding="4" cellspacing="0">
<logic:iterate id="part" name="formBuilder" property="formParts"
       type="com.nuix.itopix.dar.forms.interfaces.FormPartData">
    <tr class="formContent" valign="top">
    name="part" property="formFieldType"
    value="<%= com.nuix.itopix.dar.forms.interfaces.FormPartType.SEPARATOR_FIELD.asString()
%>">
     <td valign="top" class="formPartWithSep">
         <%@ include file="../included.jsp" %></td>     <!-- The problem is
here -->
     </tr>
</logic:iterate>
....

(2) The included JSP:
<%@ page import="com.nuix.itopix.dar.forms.interfaces.OptionSet,
                 com.nuix.itopix.dar.forms.interfaces.FormPartData,
                 com.nuix.log.ChannelManager"%>
<logic:iterate id="button" name="part" property="optionSet.options">
    <input name="<%= com.nuix.itopix.action.forms.DisplayFormAction.PART_PREFIX %>
    <jsp:getProperty name="part" property="rankOrder" />"
           type="radio"
           value="<jsp:getProperty name="button" property="value" />"
           <logic:equal name="part" property="currentValue"
            value="<%= ((OptionSet.Option) button).getValue() %>"> checked</logic:equal>
           <logic:equal name="part" property="disabled" value="true">
           onclick="return false"</logic:equal>><jsp:getProperty name="button"
property="label" />
    </input>
</logic:iterate>

As a result the following declarations appear in the toplevel_jsp.java file (I use the jspc
compiler however 
I believe that it's the case with the runtime compilation too):

(1)java.lang.Object _jspx_button_1 = null; // somewhere in the top of the file.

(2)              
/* ----  logic:iterate ---- */
java.lang.Object _jspx_button_1 = button;

At first there is duplicate declaration.
And declaration (2) is not correct due to the button variable has never been declared
in the file.

The simple fix that replaces the second declaration with the following
"java.lang.Object  button = null; " makes this jsp page compiling and working properly.

This problem has never occured with the same jsps with Jasper 1. (tomcats 4.0.x)

Has anyone expirience the problem? Are there patch/workarounds that don't require to change
the jsps sources.


Thanks in advance,
Dima 
 







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


Mime
View raw message