We're updating the issue view to help you get more done. 

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

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...

    1 2 3 4 5 6 7 ... <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...

    1 2 3 4 5 6 7 ... <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.

Environment

None

Status

Assignee

Rick G

Reporter

Dan Nelson

Labels

None

Tester

None

Components

Fix versions

Affects versions

Release 1.5.7

Priority

Minor