Reputation: 91
I am using inline frame on jsf page to render different jsff pages liked to various commandMenuItem but the page is not rendering properly its giving the message
This XML file does not appear to have any style information associated with it. The document tree is shown below.
and the displaying the page content as
how to overcome this problem and display the page properly inside the inline frame. I want that the page will display similarly inside the inline frame when we run the jsff page separatly in different window.
Upvotes: 0
Views: 988
Reputation: 91
Since jsff page do not contain any css and style information..so it will not get displayed properly inside the inline frame..but instead we can display the complete jsf page inside the inline frame..now to display the dynamic jsf page inside the inline frame upon the commandMenuItem click from the jsf page...the procedure is below..
now create a action listener bean on commandMenuItem
import javax.faces.event.ActionEvent;
public class PageBean {
String page = "home";//setting default page
public PageBean() {
}
public void getMenu(ActionEvent actionEvent) {
// Add event code here...
String id = actionEvent.getComponent().getId();
System.out.println(" Menu ID : "+id);
page = id;
System.out.println("Value assigned to the page from the menu Id is :"+page);
}
public String getPage() {
return page;
}
public void setPage(String page) {
this.page = page;
}
}
now on the secondCommandMeuItem also register the same actionListner bean
code on the main page containing menu...is
<af:panelGroupLayout id="pgl1">
<af:menuBar id="mb1">
<af:menu text="menu 1" id="m1">
<af:commandMenuItem text="commandMenuItem 1" id="page1" actionListener="#{PageBean.getMenu}">
<a4j:support event="onclick" reRender="if1"/>
</af:commandMenuItem>
</af:menu>
<af:menu text="menu 2" id="m2">
<af:commandMenuItem text="commandMenuItem 2" id="page2" actionListener="#{PageBean.getMenu}">
<a4j:support event="onclick" reRender="if1"/>
</af:commandMenuItem>
</af:menu>
</af:menuBar>
<af:inlineFrame id="if1" source="#{PageBean.page}.jsf" shortDesc="areaMp" partialTriggers="page1 page2"/><!-- getting dynamic page source from the managed bean variable(page) by fetching the menu id which is similar to the corresponding page name
also add the commandMenuId of the menu's in the partial trigger of the inline frame. -->
</af:panelGroupLayout>
You can include and display jsf page inside the inline frame and can use inline frame on jsf page and even on jsff(page fragment) also.
Upvotes: 0
Reputation: 2025
You cannot reference to jsff pages using inline frame, you can include jsff pages either by adding them into a task-flow and add the task-flow as a region, or use the jsp:include tag
Check this guide out http://docs.oracle.com/cd/E23943_01/web.1111/b31973/af_reuse.htm#CACHFJDJ
Upvotes: 2