
|
If you were logged in you would be able to see more operations.
|
|
|
|
It would be nice if the options-collection tag handled null Collections. Currently, you have to wrap the tag declaration around some sort of check like:
<c:if test="${someCollection != null}">
<stripes:options-collection...../>
</c:if>
While this is fairly easy and straightfoward, it's more verbose than need be.
|
|
Description
|
It would be nice if the options-collection tag handled null Collections. Currently, you have to wrap the tag declaration around some sort of check like:
<c:if test="${someCollection != null}">
<stripes:options-collection...../>
</c:if>
While this is fairly easy and straightfoward, it's more verbose than need be. |
Show » |
|
|
This works well for me:
Index: /home/aaron/workspace/stripes/stripes/src/net/sourceforge/stripes/tag/InputOptionsCollectionTag.java
===================================================================
--- /home/aaron/workspace/stripes/stripes/src/net/sourceforge/stripes/tag/InputOptionsCollectionTag.java (revision 476)
+++ /home/aaron/workspace/stripes/stripes/src/net/sourceforge/stripes/tag/InputOptionsCollectionTag.java (working copy)
@@ -96,7 +96,7 @@
}
/** Internal list of entires that is assembled from the items in the collection. */
- private List<Entry> entries;
+ private List<Entry> entries = new LinkedList<Entry>();
/** Sets the collection that will be used to generate options. */
public void setCollection(Collection collection) {
@@ -161,7 +161,6 @@
* @param value the actual value for the option
*/
protected void addEntry(Object item, Object label, Object value) {
- if (this.entries == null) this.entries = new LinkedList<Entry>();
this.entries.add(new Entry(item, label, value));
}
@@ -175,6 +174,9 @@
* not present on the beans in the collection
*/
public int doStartTag() throws JspException {
+ if (this.collection == null)
+ return SKIP_BODY;
+
String labelProperty = getLabel();
String valueProperty = getValue();