Requirement description:
- In JSPX page we have a table or form where parameters can be entered
- On the same page we have a button. When it is pressed, entered parameters are passed to backing bean method, where based on provided parameters URL string is generated
- Generated URL is opened in Web Browser new tab or window
I have found another solution, it is quite simple and is implemented in my sample - ReportWindow.zip. af:commandButton doesn't have Target property, but h:form does. Submit action of af:commandButton component, placed into h:form with Target property set to _blank, is always executed in new tab or window (depends on Web Browser).
Developed sample implements two h:form components - one is used for parameters and second for button:
Second h:form component property Target is set to _blank:
JSPX page backing bean contains some dummy code for URL generating. URL is opened using ExternalContext obtained from FacesContext:
This code is executed when Open Report button is pressed, URL is generated according to submited parameters. Data available in parameters form should be auto submited, in order to be available from second form where Open Report button is implemented:
Generated URL is opened in new tab:
When running sample application, don't forget to add adf-faces-impl.jar and jsf-impl.jar to application's WEB-INF\lib directory.
0 comments:
Post a Comment