fixed canRead breakage

This commit is contained in:
Juergen Hoeller 2010-04-15 16:13:50 +00:00
parent b3b5b356d2
commit 7048f32666
2 changed files with 8 additions and 4 deletions

View File

@ -155,8 +155,8 @@ public class EvalTag extends HtmlEscapingAwareTag {
} }
public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException { public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException {
return (target == null && (resolveImplicitVariable(name) != null) || return (target == null &&
this.pageContext.findAttribute(name) != null); (resolveImplicitVariable(name) != null || this.pageContext.findAttribute(name) != null));
} }
public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException { public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException {

View File

@ -17,7 +17,6 @@
package org.springframework.web.servlet.tags; package org.springframework.web.servlet.tags;
import java.math.BigDecimal; import java.math.BigDecimal;
import javax.servlet.jsp.tagext.Tag; import javax.servlet.jsp.tagext.Tag;
import org.springframework.format.annotation.NumberFormat; 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.MockHttpServletResponse;
import org.springframework.mock.web.MockPageContext; import org.springframework.mock.web.MockPageContext;
/**
* @author Keith Donald
*/
public class EvalTagTests extends AbstractTagTests { public class EvalTagTests extends AbstractTagTests {
private EvalTag tag; private EvalTag tag;
@ -91,7 +93,7 @@ public class EvalTagTests extends AbstractTagTests {
} }
// SPR-6923 // SPR-6923
public void testNestedPropertyWithAttribtueName() throws Exception { public void testNestedPropertyWithAttributeName() throws Exception {
tag.setExpression("bean.bean"); tag.setExpression("bean.bean");
tag.setVar("foo"); tag.setVar("foo");
int action = tag.doStartTag(); int action = tag.doStartTag();
@ -101,6 +103,7 @@ public class EvalTagTests extends AbstractTagTests {
assertEquals("not the bean object", context.getAttribute("foo")); assertEquals("not the bean object", context.getAttribute("foo"));
} }
public static class Bean { public static class Bean {
public String method() { public String method() {
@ -123,4 +126,5 @@ public class EvalTagTests extends AbstractTagTests {
return "function foo() { alert(\"hi\") }"; return "function foo() { alert(\"hi\") }";
} }
} }
} }