Struts:选择HTML选项? [英] Struts: HTML Option Selected?

查看:110
本文介绍了Struts:选择HTML选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在struts中,似乎没有选择选项。 HTML选项标签有一个选定的属性,您可以这样做:

 < option selected =selected> Some Option< ; /选项> 

并且该选项将被自动选择。有没有办法在struts中做到这一点?看来,在struts中,它随机自动选择一个我的选项,我不明白的原因,我想能够指定哪个选项应该自动选择。

< html:select> 标记中完成的,而不是在 < html:option> 类似于纯HTML 选项



值 nofollow> < html:select> 标记用于比较每个< html:option> 值并在找到匹配项时将其标记为选中。


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.

解决方案

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.

这篇关于Struts:选择HTML选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆