I have a JSF1.2 selectOneMenu component.
Currently, a user selects an item from the dropdown menu, then clicks an output link to open a url in a new browser window:
<h:selectOneMenu value="#{itemSelected}" valueChangeListener="#{someclass.generateInfoForURL}" onchange="submit()" >
<s:selectItems var="_items" value="#{itemsList}" label="#_items.itemName}" />
<s:convertEntity />
</h:selectOneMenu>
<h:outputLink value="URL&generatedInfo=#{someclass.component.generatedInfo}" target="_blank" >
<f:verbatim>View Report</f:verbatim>
</h:outputLink>
What I need is; when a user selects one of the dropdown items it should open the URL in a new page without the intermediate step of selecting the link. I can build the URL in the backing bean, but how do I get it to open a new browser window?
Provide the URL as item value and use JavaScript to open it in a new tab/window instead of to submit the form. You only need to ensure that all URLs are already rightly prepared beforehand.
E.g.
(you can of course supply it as
<f/s:selectItems>, the above is just a basic kickoff example)