Browse Source

fixed indexed property regression (SPR-6871)

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3018 50f2f4bb-b051-0410-bef5-90022cba6387
pull/1/head
Juergen Hoeller 16 years ago
parent
commit
9687dd4620
  1. 4
      org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/tags/form/AbstractCheckedElementTag.java
  2. 6
      org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/tags/form/AbstractDataBoundFormElementTag.java
  3. 2
      org.springframework.web.servlet/src/test/java/org/springframework/web/servlet/tags/form/CheckboxTagTests.java

4
org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/tags/form/AbstractCheckedElementTag.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2009 the original author or authors.
* Copyright 2002-2010 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -77,7 +77,7 @@ public abstract class AbstractCheckedElementTag extends AbstractHtmlInputElement @@ -77,7 +77,7 @@ public abstract class AbstractCheckedElementTag extends AbstractHtmlInputElement
*/
@Override
protected String autogenerateId() throws JspException {
return TagIdGenerator.nextId(getName(), this.pageContext);
return TagIdGenerator.nextId(super.autogenerateId(), this.pageContext);
}

6
org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/tags/form/AbstractDataBoundFormElementTag.java

@ -144,7 +144,7 @@ public abstract class AbstractDataBoundFormElementTag extends AbstractFormTag im @@ -144,7 +144,7 @@ public abstract class AbstractDataBoundFormElementTag extends AbstractFormTag im
* deleting invalid characters (such as "[" or "]").
*/
protected String autogenerateId() throws JspException {
return getName();
return StringUtils.deleteAny(getName(), "[]");
}
/**
@ -152,12 +152,12 @@ public abstract class AbstractDataBoundFormElementTag extends AbstractFormTag im @@ -152,12 +152,12 @@ public abstract class AbstractDataBoundFormElementTag extends AbstractFormTag im
* <p>The default implementation simply delegates to
* {@link #getPropertyPath()} to use the property path as the name.
* For the most part this is desirable as it links with the server-side
* expectation for databinding. However, some subclasses may wish to change
* expectation for data binding. However, some subclasses may wish to change
* the value of the '<code>name</code>' attribute without changing the bind path.
* @return the value for the HTML '<code>name</code>' attribute
*/
protected String getName() throws JspException {
return StringUtils.deleteAny(getPropertyPath(), "[]");
return getPropertyPath();
}
/**

2
org.springframework.web.servlet/src/test/java/org/springframework/web/servlet/tags/form/CheckboxTagTests.java

@ -96,7 +96,7 @@ public class CheckboxTagTests extends AbstractFormTagTests { @@ -96,7 +96,7 @@ public class CheckboxTagTests extends AbstractFormTagTests {
assertEquals("input", checkboxElement.getName());
assertEquals("checkbox", checkboxElement.attribute("type").getValue());
assertEquals("someMapkey1", checkboxElement.attribute("id").getValue());
assertEquals("someMapkey", checkboxElement.attribute("name").getValue());
assertEquals("someMap[key]", checkboxElement.attribute("name").getValue());
assertEquals("checked", checkboxElement.attribute("checked").getValue());
assertEquals("true", checkboxElement.attribute("value").getValue());
}

Loading…
Cancel
Save