Uploaded image for project: 'Stripes'
  1. STS-898

<stripes:option> 'selected' Attribute Should (For Consistency Sake) Accept Boolean Values

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects versions: Release 1.5.7
    • Fix versions: Release 1.6
    • Components: Tag Library
    • Labels:
      None
    • Sprint:

      Description

      We've made sure that <stripes:text>, <stripes:textarea>, <stripes:select> elements accept boolean-like values for attributes like:

      • readonly
      • disabled
      • multiple
        ...This allows us to embed EL expressions into the afore mentioned attributes that in turn yield the appropriate html markup. We seem to have forgotten to apply this behaviour to the <stripes:option> element. In the following snippet, my ActionBeanContext has a getUserDateTimeZone() read method, that returns a org.joda.time.DateTimeZone instance representing the current request's timezone. Let's pretend this requests timezone is set to America/Vancouver, the following code:
        JSP markup...
        ...
        <stripes:select name="dateTimeZoneId">
          <stripes:option value="America/Vancouver" selected="${requestScope.actionBean.context.userDateTimeZone.ID}">America/Vancouver</stripes:option>
          <stripes:option value="America/Edmonton" selected="${requestScope.actionBean.context.userDateTimeZone.ID}">America/Edmonton</stripes:option>
          <stripes:option value="America/Regina" selected="${requestScope.actionBean.context.userDateTimeZone.ID}">America/Regina</stripes:option>
        </stripes:select>
        ...
        

        ...will produce a select box whose options are all in a selected state (the last one, America/Regina being displayed as the selected option):

        Actual html...
        ...
        <select name="dateTimeZoneId">
          <option value="America/Vancouver" selected="selected">America/Vancouver</option>
          <option value="America/Edmonton" selected="selected">America/Edmonton</option>
          <option value="America/Regina" selected="selected">America/Regina</option>
        </select>
        ...
        

      It is my opinion that the <stripes:option> element's selected attribute should behave more like the <stripes:text> element's readonly attribute, whereby it accepts boolean-like expressions and in accordance produces the correct html markup for the supplied condition value.

        Attachments

          Activity

            People

            • Assignee:
              rgrashel Rick Grashel
              Reporter:
              dnelson Dan Nelson
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: