Search code examples
htmltagshtml-selectstruts

Equivalent for select tag with choose multiple options in struts


Hi I want to know the equivalent code in struts.

    <-select->
       <-option value="a"-> a <-/option->
       <-option value="b"-> b <-/option->
       <-option value="c"-> c <-/option->
       <-option value="d"-> d <-/option->
    <-/select->

we can represent the above in struts as

    <-sj:select-><-/sj:select->

Like that how to represent the following code that allows to select "multiple" values.

    <-select multiple="multiple"->
       <-option value="a"-> a <-/option->
       <-option value="b"-> b <-/option->
       <-option value="c"-> c <-/option->
       <-option value="d"-> d <-/option->
    <-/select->

I tried this. But no use.

    <-sj:select multiple="multiple"-><-/sj:select->

TIA.


Solution

  • The tags are documented:

    multiple - required: false - default: false - evaluated: false - type: Boolean

    Creates a multiple select. The tag will pre-select multiple values if the values are passed as an Array or a Collection(of appropriate types) via the value attribute. If one of the keys equals one of the values in the Collection or Array it wil be selected