You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2012/10/16 11:02:18 UTC

[Bug 54012] No "pageContext" in tag files' generated java code when using code generation by JSTL tagplugin "Set"

https://issues.apache.org/bugzilla/show_bug.cgi?id=54012

Sheldon Shao <xs...@ebay.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #29485|0                           |1
           is patch|                            |

--- Comment #1 from Sheldon Shao <xs...@ebay.com> ---
Comment on attachment 29485
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=29485
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("}");
>

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org