oni*_*unn 3 jsf hyperlink selectonemenu
是否有可能设置一个<a href />
在我<f:selectItem itemLabel="label" />
在我的链接文字是itemLabel
?
我正在使用普通的太阳组件.
期望的结果是不是可以在HTML中.您需要为此添加JavaScript镜头.
<h:selectOneMenu onchange="window.location=this.options[this.selectedIndex].value">
<f:selectItems value="#{bean.links}" />
<h:selectOneMenu>
Run Code Online (Sandbox Code Playgroud)
当bean.getLinks()
返回一个List<SelectItem>
带有fullworthy URL作为项目价值.如果你想显示的联系,两者值和标签,只需使用SelectItem
构造函数取一个参数.
links = new List<SelectItem>();
links.add(new SelectItem("http://google.com"));
links.add(new SelectItem("http://stackoverflow.com"));
// ...
Run Code Online (Sandbox Code Playgroud)
如果你想在视图中对它们进行硬编码,那么你当然可以抓住f:selectItem
:
<h:selectOneMenu onchange="window.location=this.options[this.selectedIndex].value">
<f:selectItem itemValue="http://google.com" />
<f:selectItem itemValue="http://stackoverflow.com" />
<h:selectOneMenu>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2526 次 |
最近记录: |