fixed indexed property regression (SPR-6871)

This commit is contained in:
Juergen Hoeller 2010-02-20 15:53:09 +00:00
parent 5063c6dd00
commit 67b342d923
3 changed files with 6 additions and 6 deletions

View File

@ -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
*/
@Override
protected String autogenerateId() throws JspException {
return TagIdGenerator.nextId(getName(), this.pageContext);
return TagIdGenerator.nextId(super.autogenerateId(), this.pageContext);
}

View File

@ -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
* <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();
}
/**

View File

@ -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());
}