JSF link in SelectItem shortcut
The desired result is not . To do this, you need to add a snapshot of JavaScript.
<h:selectOneMenu onchange="window.location=this.options[this.selectedIndex].value">
<f:selectItems value="#{bean.links}" />
<h:selectOneMenu>
Where bean.getLinks()returns List<SelectItem>with a full URL as an element value . If you want to show the link as a value and label, just use the constructor SelectItemusing one argument.
links = new List<SelectItem>();
links.add(new SelectItem("http://google.com"));
links.add(new SelectItem("http://stackoverflow.com"));
// ...
If you want to write them as hard code, you can, of course, take 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>