Dynamic page/menu updates in nested layout

Components, Ajax Framework, Utilities and More.
Post Reply
baconinja
Posts: 3
Joined: 07 Jul 2012, 00:50
Location: Bay

12 Jul 2012, 06:42

I am fairly new to JSF and PrimeFaces and have a couple issues in developing a full page layout with multiple menus.

ISSUE #1

We have a full page layout using PrimeFaces 3.3 with nested layout units on the left side as follows:

Code: Select all

<p:layoutUnit id="west" position="west" header="Services" resizable="true" closable="true" collapsible="true" effect="drop">
            <p:layout>                                          
                <p:layoutUnit id="inner_center" position="center">                        
                   <h:form id="formMainMenu">
                        <ui:include src="#{menuBean.pageToDisplay}.xhtml" />
                   </h:form>               
                </p:layoutUnit>
                <p:layoutUnit id="inner_south" size="200" position="south">                                       
                    <h:form id="formStartMenu">
                        <p:menu>
                            <p:submenu label="Start Menu">                                    
                                <p:menuitem value="Start" actionListener="#{#menuBean.setPageToDisplay('template/menu/start')}" update=":inner_center" />                                    
                            </p:submenu>
                        </p:menu>
                    </h:form>
                </p:layoutUnit>
            </p:layout>
        </p:layoutUnit>
Here is the backing bean:

Code: Select all

@ManagedBean(name = "menuBean")
@SessionScoped
public class menuBean implements Serializable {

private String pageToDisplay = "template/menu/main";

public String getPageToDisplay() {
    return this.pageToDisplay;
}

public void setPageToDisplay(String pageToDisplay) {
    this.pageToDisplay = pageToDisplay; 
} 
}
When I click on the menuItem, the entire LayoutUnit (inner_center) disappears. I have tried numerous combinations of Forms and Panel controls along with Ajax and cannot get the second page and menu to load. Maybe my approach is incorrect due to my limited knowledge in JSF. I am hoping this something simple and I am just missing it.

From a menuItem action, I want to load another PrimeFaces menu bean in the inner_center layout unit.. maybe I don't need to do this and just call the menu via Ajax?

ISSUE # 2

With these nested layoutunits, when the page loads, the parent LayoutUnit header "Services" disappears completely.

Code: Select all

<p:layoutUnit id="west" position="west" header="Services" resizable="true" closable="true" collapsible="true" effect="drop">
Any help or advice on the overall approach is greatly appreciated!!
Thanks!
- baconinja
Mojara 2.1, Primefaces 3.3, NetBeans IDE 7.0.1 + Glassfish

baconinja
Posts: 3
Joined: 07 Jul 2012, 00:50
Location: Bay

12 Jul 2012, 18:15

IDEALLY, I would like to skip loading a page and place a menu in directly in the layoutUnit and populate it dynamically by passing a value.

Code: Select all

<p:menu model="#{coreMainMenuBean.changeMainMenu(passed.value)}"/> 
Not sure the best way though. Still trying to understand communication of data between beans and the JSF lifecycle.

FYI - This question has also been posted to StackOverflow.
http://stackoverflow.com/questions/1144 ... ces-layout
Thanks!
- baconinja
Mojara 2.1, Primefaces 3.3, NetBeans IDE 7.0.1 + Glassfish

Post Reply
  • Information
  • Who is online

    Users browsing this forum: Baidu [Spider] and 11 guests