The following changes allow any collection of objects to be used to generate
the values and labels for a <select> tag. I take advantage of the fact that
toString() on a String just returns this. Of course, its up to the user to
use objects with a resonably presentable toString() method.
Cheers
Chris
--- OptionsTag.java 2000/08/14 04:42:51 1.4
+++ OptionsTag.java 2000/09/21 23:18:40
@@ -182,10 +182,10 @@
// Render the options tags for each element of the values collection
StringBuffer sb = new StringBuffer();
while (valuesIterator.hasNext()) {
- String value = (String) valuesIterator.next();
+ String value = valuesIterator.next().toString();
String label = value;
if (labelsIterator.hasNext())
- label = (String) labelsIterator.next();
+ label = labelsIterator.next().toString();
sb.append("<option value=\"");
sb.append(value);
sb.append("\"");
|