0

Hi I'm trying to create a Programmatic menu and I'm using the primefaces example but when I deploy the server doesn't show, any idea I'm using tomcat v8.5 and Primefaces 7.0

public class MenuBean {
private MenuModel model;

public MenuBean() {
    //Add menus and submenus
}
public MenuModel getModel() { 
    return model;
 }
}

the xhtml file

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui" xmlns:b="http://bootsfaces.net/ui"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:sec="http://www.springframework.org/security/tags">
<h:head>
    <f:metadata>
        <f:event listener="#{foo.loadUserSession}"
            type="preRenderView" />
    </f:metadata>
</h:head>
    <h:form>
        <b:row>

            <p:menu model="#{menuBean.model}" />
        </b:row>

    </h:form>
   </ui:composition>
Selaron
  • 6,105
  • 4
  • 31
  • 39
ibrajim19
  • 17
  • 5
  • Possible duplicate of [JSF returns blank/unparsed page with plain/raw XHTML/XML/EL source instead of rendered HTML output](https://stackoverflow.com/questions/3112946/jsf-returns-blank-unparsed-page-with-plain-raw-xhtml-xml-el-source-instead-of-re) – Selaron Nov 21 '19 at 16:47
  • And don't mix jsf namespaces... – Kukeltje Nov 22 '19 at 00:23

1 Answers1

0

Did you add the tags to your class? Did you initiated MenuModel model?

@Named
@RequestScoped
public class MenuBean {

    private MenuModel model;

    @PostConstruct
    public void init() {
        model = new DefaultMenuModel();
    }

    public MenuModel getModel() { 
        return model;
    }
}

Probably that's why it isn't showing when you start.