tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject DO NOT REPLY [Bug 48616] Struts 1.2 and bean:define tag throws jsp 1.1 regression exception
Date Sun, 14 Feb 2010 06:07:38 GMT

--- Comment #15 from Konstantin Kolinko <> 2010-02-14 06:07:32
UTC ---
Reviewing the fix to this issue,
I cannot find any provision in the JSP specification to support the requested

The question is, when we are requested to declare a Java variable whether we
should try to reuse existing declaration, or we should always declare it anew.

I cannot find anything in the spec that says about reusing existing
declaration. The only place relevant is chapter JSP.9.4.4 "Actions", and it
says that when we do a custom action, it is translated into Java code as

declare AT_BEGIN variables
  declare NESTED variables
  transformation of foo
declare AT_END variables

It just says "declare".

Looking at the example provided in Comment 2:

In struts 1.2.8 the bean:define tag is a BodyTag, which in its *Tei class
declares a variable with the scope of VariableInfo.AT_END


The OP's problem is that such a tag defines both a scoped variable and a Java
variable ("scripting variable"). It is OK to put a value into pageContext under
the same name, but duplicate Java variables are not allowed.

To be able to implement behaviour, requested in Comment 2, Tomcat would have to
track which Java variables were declared. So, to not define a variable when it
is created by the second time. But, consider the following example of mixing
scriptlets and those tags:

<% { %>

<bean:define id="configurationExists" toScope="request" value="0"/>

<% } { %>

<bean:define id="configurationExists" toScope="request" value="1"/>

<% } %>

There is no way to reliably tell the difference between the above example and
the one in Comment 2.

To conclude, I would recommend the OP to use the following construct (using the
JSTL tag library). I think, that it should be safe:

<c:if test="${true}">
<bean:define id="configurationExists" toScope="request" value="0"/>
<c:if test="${true}">
<bean:define id="configurationExists" toScope="request" value="1"/>

Or, use <c:set /> from the same JSTL library.

Thus, I think that this issue should be closed either as WONTFIX, or as

Configure bugmail:
------- You are receiving this mail because: -------
You are the assignee for the bug.

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

View raw message