tomcat-users mailing list archives

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

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.

<table class="formTable" cellpadding="4" cellspacing="0">
<logic:iterate id="part" name="formBuilder" property="formParts"
    <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 -->

(2) The included JSP:
<%@ page import="com.nuix.itopix.dar.forms.interfaces.OptionSet,
<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" />"
           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" />

As a result the following declarations appear in the 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.

/* ----  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,

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message