Loading Content from another JSF page into panelGroup
ellisd5 Jun 12, 2009 10:47 AMHi all,
I am a Java developer who has been working creating JSF framework UI's for past 3 years. My contract has just finished so I am getting the chance to have a look a some technoligies. I have come across RichFaces, which I have never heard of before and I have to say, the small amount I have seen of it looks pretty awesome.
A common thing I used to do is have a seperate JSF file which would display a dataTable. That JSF file would get loaded into a DIV when I made a AJAX call to that JSF file. So I'm trying to recreate that functionality with RichFaces and I just can't get it to work, I have been reading documents and googling, I see others have had this problem but I cant find the sollution. So this is my code, index.jsp...
<f:view> <a4j:form id="homeForm"> <a4j:commandButton action="#{events.search}" value="Do Search..." reRender="eventsDisplay" onclick="this.disabled=true" oncomplete="this.disabled=false" /> <rich:separator height="10px" lineType="none" /> <h:panelGroup id="eventsDisplay" > ... </h:panelGroup> </a4j:form> </f:view>
What I was expecting(wanting) to happen is that search() method from the events session bean is called, that runs some code and returns 'events' string. The Navigation in the faces-config.xml says that events.jsp gets loaded. So I would expect the HTML code generated by events.jsp to be loaded into the panelGroup "eventsDisplay". However this is not the case. What happens is events.jsp is loaded but it replaces the whole page and not just loaded into the panel.
Hope this clear what I am trying to achieve, so how do I accomplish this? I have seen a few things in other forums saying to do this...
<a4j:region> <h:commandButton value="Do Search..." > <a4j:support action="#{events.search}" event="onclick" reRender="eventsDisplay" ajaxSingle="true" /> </h:commandButton> </a4j:region>
I dont really know what that code is trying to do but the result is the same as I had before. Could anyone advise on where I am going wrong?, I assume it must be possible. I have looked at the generated code and I see no reference to eventsDisplay in the input buttons onclick code so I am not surprised it is not loading into the panel, but how can I do it?
TIA,
Dale Ellis