Struts: HTML Option Selected?
Asked Answered
W

1

7

In struts, it seems there is no "selected" option. The HTML option tag has a selected attribute such that you can do:

<option selected="selected">Some Option</option>

and that option will be automatically selected. Is there a way to do this in struts? It seems that in struts, its randomly auto-selected one my options for a reason I don't understand and I would like to be able to specify which option should be auto selected.

Walleye answered 31/8, 2011 at 19:15 Comment(0)
V
4

In Struts this is done in the <html:select> tag and not in the <html:option> like for the the case of plain HTML option.

The value attribute of the <html:select> tag is used to compare against each <html:option> value and marking it as selected if a match is found.

Villatoro answered 1/9, 2011 at 19:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.