The following scriplet does not compile: <i18n:bundle baseName="TextBundle/text" localeRef="userLocale" id="text" /> <% if(true) {%> <i18n:message bundleRef="text" key="my_key" id="value"/> <% } else { %> <i18n:message bundleRef="text" key="my_key" id="value"/> <% } %> When launched, throws an exception: org.apache.jasper.JasperException: Unable to compile class for JSP Generated servlet error: C:\Fujitsu\InterstageBPM\taskmanager\tomcat\work\Catalina\localhost\ibpm\org\apache\jsp\jsp\TestJSP_jsp.java:120: cannot resolve symbol symbol : variable value location: class org.apache.jsp.jsp.TestJSP_jsp value = (java.lang.String) _jspx_page_context.findAttribute("value"); ^ 1 error In the servlet TestJSP_jsp.java, the corresponding code looks like if(true) { // i18n:message org.apache.taglibs.i18n.MessageTag _jspx_th_i18n_message_0 = (org.apache.taglibs.i18n.MessageTag) _jspx_tagPool_i18n_message_key_id_bundleRef_nobody.get(org.apache.taglibs.i18n.MessageTag.class); _jspx_th_i18n_message_0.setPageContext(_jspx_page_context);_jspx_th_i18n_message_0.setParent(null); _jspx_th_i18n_message_0.setBundleRef("text"); _jspx_th_i18n_message_0.setKey("my_key"); _jspx_th_i18n_message_0.setId("value"); int _jspx_eval_i18n_message_0 = _jspx_th_i18n_message_0.doStartTag(); if (_jspx_th_i18n_message_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; _jspx_tagPool_i18n_message_key_id_bundleRef_nobody.reuse(_jspx_th_i18n_message_0); java.lang.String value = null; value = (java.lang.String) _jspx_page_context.findAttribute("value"); } else { org.apache.taglibs.i18n.MessageTag _jspx_th_i18n_message_1 = (org.apache.taglibs.i18n.MessageTag) _jspx_tagPool_i18n_message_key_id_bundleRef_nobody.get(org.apache.taglibs.i18n.MessageTag.class); _jspx_th_i18n_message_1.setPageContext(_jspx_page_context); _jspx_th_i18n_message_1.setParent(null); _jspx_th_i18n_message_1.setBundleRef("text"); _jspx_th_i18n_message_1.setKey("my_key"); _jspx_th_i18n_message_1.setId("value"); int _jspx_eval_i18n_message_1 = _jspx_th_i18n_message_1.doStartTag(); if (_jspx_th_i18n_message_1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return; _jspx_tagPool_i18n_message_key_id_bundleRef_nobody.reuse(_jspx_th_i18n_message_1); //HERE IS WHERE IT GOES WRONG! value = (java.lang.String) _jspx_page_context.findAttribute("value"); } In the else-part, the variable <code>value<code> is not declared, which is the cause of compilation error. It looks like the tag in the if-part sees that there is already a variable with the same name, and tries to reuse it. The problem is aybe in the method <code>getVariableInfo TagData data)</code> in the <code>MessageTEI</code> class: public VariableInfo [] getVariableInfo (TagData data) { String varName = data.getId(); if ( varName == null ) { return new VariableInfo[] {}; } else { return new VariableInfo [] { new VariableInfo(varName, "java.lang.String", true, VariableInfo.AT_END) }; } } One should probably investigate the scope of the variable, in case it was already declared somewhere earlier in the page.
JSTL replaced the i18n taglib, so this won't be worked on.