I have a JSF page in which I have a div which acts as a popup window.
This popup is displayed when the user clicks on a certain button or link, until which it is hidden.
I would like to have another JSF page that provides the content for this div via an AJAX call.
I vaguely remember doing this using Struts Action and JSP fragment.
Is it possible to do this in JSF 2.0?
ADDITIONAL DETAILS:
My scenario is as follows:
- I have a page that displays the details of employees as a summary table using the
dataTabletag with a classEmployeeInfoas a backing bean that provides aCollectionofEmployeeBeans. On this page I have aradiobutton as the first column in thedataTable. This page has adivthat is hidden. - When the
radiobutton is switch on and a certain button is clicked, over anAJAXcall we need to hit the backing bean to get the details of theEmployeeBeanthat has been selected as above and populate thedivbased on thisAJAXcall.
The reason why I do not want to have a full submit on the first page and get the second page is, because I want to save the state of any changes that have been done on the first page.
Using a tag, you are able to show or hide content quite easily. This is all rough code typed out quickly but in your bean, imagine you had the following:
Then in your JSF page, you’d have a link to show hide your popup done as a ui:fragment:
That ui:fragment could easily be in another JSF page that you include via ui:include if you need it to be. The important bit is that the f:ajax take is what makes the AJAX call (on a click event in this case) and updates the specified element (hiddenarea).