ASF Bugzilla – Attachment 23032 Details for
Bug 45197
Need to support the JSTL 1.2 specification
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Fix to previous patch for one file that does not happily apply.
SetSupport.patch (text/plain), 3.41 KB, created by
Henri Yandell
on 2008-12-17 00:34:44 UTC
(
hide
)
Description:
Fix to previous patch for one file that does not happily apply.
Filename:
MIME Type:
Creator:
Henri Yandell
Created:
2008-12-17 00:34:44 UTC
Size:
3.41 KB
patch
obsolete
>Index: src/org/apache/taglibs/standard/tag/common/core/SetSupport.java >=================================================================== >--- src/org/apache/taglibs/standard/tag/common/core/SetSupport.java (revision 727309) >+++ src/org/apache/taglibs/standard/tag/common/core/SetSupport.java (working copy) >@@ -27,12 +27,15 @@ > import java.util.Map; > > import javax.servlet.jsp.JspException; >+import javax.servlet.jsp.JspFactory; > import javax.servlet.jsp.JspTagException; > import javax.servlet.jsp.PageContext; > >-import javax.servlet.jsp.el.ELException; >-import javax.servlet.jsp.el.ExpressionEvaluator; >-import javax.servlet.jsp.el.VariableResolver; >+import javax.el.ELException; >+import javax.el.ELContext; >+import javax.el.ValueExpression; >+import javax.el.VariableMapper; >+import javax.el.ExpressionFactory; > > import javax.servlet.jsp.tagext.BodyTagSupport; > >@@ -114,9 +117,30 @@ > * is made to store something in the session without any > * HttpSession existing). > */ >+ ELContext myELContext = pageContext.getELContext(); >+ VariableMapper vm = myELContext.getVariableMapper(); > if (result != null) { >- pageContext.setAttribute(var, result, scope); >+ //check for instanceof valueExpression >+ if (result instanceof ValueExpression) { >+ if (scope!=PageContext.PAGE_SCOPE) { >+ throw new JspException("Incorrect scope for ValueExpression. PageScope is required."); >+ } >+ //set variable in var Mapper >+ vm.setVariable(var, (ValueExpression)result); >+ } else { >+ /* >+ //else if not valueExpression - make sure to remove it from the Var mapper >+ //if the scope is page, should I remove this? >+ if (vm.resolveVariable(var)!=null) { >+ vm.setVariable(var, null); >+ }*/ >+ pageContext.setAttribute(var, result, scope); >+ } > } else { >+ //make sure to remove it from the Var mapper >+ if (vm.resolveVariable(var)!=null) { >+ vm.setVariable(var, null); >+ } > if (scopeSpecified) > pageContext.removeAttribute(var, scope); > else >@@ -179,15 +203,9 @@ > * rules of the Expression Language. > */ > private Object convertToExpectedType(final Object value, Class expectedType) throws ELException { >- ExpressionEvaluator evaluator = pageContext.getExpressionEvaluator(); >- return evaluator.evaluate( "${result}", >- expectedType, >- new VariableResolver() { >- public Object resolveVariable(String pName) throws ELException { >- return value; >- } >- }, >- null); >+ JspFactory jspFactory = JspFactory.getDefaultFactory(); >+ ExpressionFactory expressionFactory = jspFactory.getJspApplicationContext(pageContext.getServletContext()).getExpressionFactory(); >+ return expressionFactory.coerceToType(value, expectedType); > } > > //*********************************************************************
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 45197
:
22121
| 23032