Struts:选择HTML选项?

wel*_*lly 7 html struts selected option

在struts中,似乎没有"选择"选项.HTML选项标签具有选定的属性,您可以执行以下操作:

<option selected="selected">Some Option</option>
Run Code Online (Sandbox Code Playgroud)

并且将自动选择该选项.有没有办法在struts中这样做?似乎在struts中,它随机自动选择了一个我的选项,原因我不明白,我希望能够指定哪个选项应该自动选择.

小智 4

在 Struts 中,这是在<html:select>标签中完成的,而不是像<html:option>纯 HTML 的情况那样option

value标签的属性用于<html:select>与每个<html:option>值进行比较,如果找到匹配则将其标记为已选择。