Revision: 1453
          http://stripes.svn.sourceforge.net/stripes/?rev=1453&view=rev
Author:   bengunter
Date:     2011-12-02 17:07:55 +0000 (Fri, 02 Dec 2011)
Log Message:
-----------
Applied fix for STS-853 from 1.5.x branch.

Modified Paths:
--------------
    trunk/stripes/src/net/sourceforge/stripes/tag/InputOptionsCollectionTag.java

Modified: 
trunk/stripes/src/net/sourceforge/stripes/tag/InputOptionsCollectionTag.java
===================================================================
--- 
trunk/stripes/src/net/sourceforge/stripes/tag/InputOptionsCollectionTag.java    
    2011-12-02 17:03:07 UTC (rev 1452)
+++ 
trunk/stripes/src/net/sourceforge/stripes/tag/InputOptionsCollectionTag.java    
    2011-12-02 17:07:55 UTC (rev 1453)
@@ -93,6 +93,19 @@
  * @author Tim Fennell
  */
 public class InputOptionsCollectionTag extends HtmlTagSupport {
+    /** A helper for writing HTML <optgroup> tags. */
+    private final HtmlTagSupport optgroupSupport = new HtmlTagSupport() {
+        @Override
+        public int doStartTag() throws JspException {
+            return 0;
+        }
+
+        @Override
+        public int doEndTag() throws JspException {
+            return 0;
+        }
+    };
+
     private Collection<? extends Object> collection;
     private String value;
     private String label;
@@ -323,6 +336,7 @@
 
         Object lastGroup = null;
 
+        JspWriter out = getPageContext().getOut();
         for (Entry entry : sortedEntries) {
             // Set properties common to all options
             tag.getAttributes().putAll(getAttributes());
@@ -333,11 +347,12 @@
             try {
                 if (entry.group != null && !entry.group.equals(lastGroup))
                 {
-                    JspWriter out = getPageContext().getOut();
-                    out.write("<optgroup label=\"");
-                    out.write(String.valueOf(entry.group).replaceAll("\"", 
"&quot;"));
-                    out.write(isXmlTags() ? "\" />" : "\">");
+                    if (lastGroup != null)
+                        optgroupSupport.writeCloseTag(out, "optgroup");
 
+                    optgroupSupport.set("label", String.valueOf(entry.group));
+                    optgroupSupport.writeOpenTag(out, "optgroup");
+
                     lastGroup = entry.group;
                 }
 
@@ -360,6 +375,9 @@
             }
         }
 
+        if (lastGroup != null)
+            optgroupSupport.writeCloseTag(out, "optgroup");
+
         // Clean up any temporary state
         this.entries.clear();
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to