diff --git a/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/tags/EvalTag.java b/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/tags/EvalTag.java index 9365f16c85c..18ac1a90fd6 100644 --- a/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/tags/EvalTag.java +++ b/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/tags/EvalTag.java @@ -155,8 +155,8 @@ public class EvalTag extends HtmlEscapingAwareTag { } public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException { - return (target == null && (resolveImplicitVariable(name) != null) || - this.pageContext.findAttribute(name) != null); + return (target == null && + (resolveImplicitVariable(name) != null || this.pageContext.findAttribute(name) != null)); } public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException { diff --git a/org.springframework.web.servlet/src/test/java/org/springframework/web/servlet/tags/EvalTagTests.java b/org.springframework.web.servlet/src/test/java/org/springframework/web/servlet/tags/EvalTagTests.java index a2d31405cea..0ae40d9b3c3 100644 --- a/org.springframework.web.servlet/src/test/java/org/springframework/web/servlet/tags/EvalTagTests.java +++ b/org.springframework.web.servlet/src/test/java/org/springframework/web/servlet/tags/EvalTagTests.java @@ -17,7 +17,6 @@ package org.springframework.web.servlet.tags; import java.math.BigDecimal; - import javax.servlet.jsp.tagext.Tag; import org.springframework.format.annotation.NumberFormat; @@ -26,6 +25,9 @@ import org.springframework.format.support.FormattingConversionServiceFactoryBean import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.mock.web.MockPageContext; +/** + * @author Keith Donald + */ public class EvalTagTests extends AbstractTagTests { private EvalTag tag; @@ -91,7 +93,7 @@ public class EvalTagTests extends AbstractTagTests { } // SPR-6923 - public void testNestedPropertyWithAttribtueName() throws Exception { + public void testNestedPropertyWithAttributeName() throws Exception { tag.setExpression("bean.bean"); tag.setVar("foo"); int action = tag.doStartTag(); @@ -101,6 +103,7 @@ public class EvalTagTests extends AbstractTagTests { assertEquals("not the bean object", context.getAttribute("foo")); } + public static class Bean { public String method() { @@ -123,4 +126,5 @@ public class EvalTagTests extends AbstractTagTests { return "function foo() { alert(\"hi\") }"; } } + }