https://issues.apache.org/bugzilla/show_bug.cgi?id=48616
--- Comment #15 from Konstantin Kolinko <knst.koli...@gmail.com> 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 behaviour. 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 See http://svn.apache.org/viewvc/struts/struts1/tags/STRUTS_1_2_8/src/share/org/apache/struts/taglib/bean/DefineTag.java?view=markup http://svn.apache.org/viewvc/struts/struts1/tags/STRUTS_1_2_8/src/share/org/apache/struts/taglib/bean/DefineTei.java?view=markup 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> <c:if test="${true}"> <bean:define id="configurationExists" toScope="request" value="1"/> </c:if> Or, use <c:set /> from the same JSTL library. Thus, I think that this issue should be closed either as WONTFIX, or as INVALID. -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org