Created attachment 29485 [details] Patch for org.apache.jasper.tagplugins.jstl.core.Set.java The code generated by the following code from " org.apache.jasper.tagplugins.jstl.core.Set" can't work in Tag Files. There is no "PageContext" in tag file. So this should check "isTagFile". String strVar = ctxt.getConstantAttribute("var"); ctxt.generateJavaSource("if(null != " + resultName + "){"); ctxt.generateJavaSource(" pageContext.setAttribute(\"" + strVar + "\"," + resultName + "," + iScope + ");"); ctxt.generateJavaSource("} else {"); if(hasScope){ ctxt.generateJavaSource(" pageContext.removeAttribute(\"" + strVar + "\"," + iScope + ");"); }else{ ctxt.generateJavaSource(" pageContext.removeAttribute(\"" + strVar + "\");"); } ctxt.generateJavaSource("}");
Comment on attachment 29485 [details] Patch for org.apache.jasper.tagplugins.jstl.core.Set.java >Index: org/apache/jasper/tagplugins/jstl/core/Set.java >=================================================================== >--- org/apache/jasper/tagplugins/jstl/core/Set.java (revision 1370136) >+++ org/apache/jasper/tagplugins/jstl/core/Set.java (working copy) >@@ -70,14 +70,20 @@ > > //if the attribute var has been specified then assign the result to the var; > if(hasVar){ >+ String jspCtxt = null; >+ if (ctxt.isTagFile()) { >+ jspCtxt = "this.getJspContext()"; >+ } else { >+ jspCtxt = "_jspx_page_context"; >+ } > String strVar = ctxt.getConstantAttribute("var"); > ctxt.generateJavaSource("if(null != " + resultName + "){"); >- ctxt.generateJavaSource(" pageContext.setAttribute(\"" + strVar + "\"," + resultName + "," + iScope + ");"); >+ ctxt.generateJavaSource(" "+jspCtxt+".setAttribute(\"" + strVar + "\"," + resultName + "," + iScope + ");"); > ctxt.generateJavaSource("} else {"); > if(hasScope){ >- ctxt.generateJavaSource(" pageContext.removeAttribute(\"" + strVar + "\"," + iScope + ");"); >+ ctxt.generateJavaSource(" "+jspCtxt+".removeAttribute(\"" + strVar + "\"," + iScope + ");"); > }else{ >- ctxt.generateJavaSource(" pageContext.removeAttribute(\"" + strVar + "\");"); >+ ctxt.generateJavaSource(" "+jspCtxt+".removeAttribute(\"" + strVar + "\");"); > } > ctxt.generateJavaSource("}"); >
Created attachment 29486 [details] Patch for Compiler.java
Created attachment 29487 [details] Patch for PageInfo.java
Created attachment 29488 [details] Patch for TagPluginContext.java
Created attachment 29489 [details] Patch for TagPluginManager.java
Thanks for the patch. I applied a slightly modified version to trunk and 7.0.x. I also added a test case to trunk. The fix will be in 7.0.33 onwards.