How to create a reuseable template with header/footer/navigation?

前端 未结 1 2025
情歌与酒
情歌与酒 2021-02-08 12:28

I have been playing with JSF and have a project working that has a header/footer/navigation/content panels. The project, however, goes from page 1 to page 2, etc., with each pag

1条回答
  •  半阙折子戏
    2021-02-08 13:07

    This sounds like a classic case of a master template. In such a template you put everything that's common to all pages and then your actual pages reference this template and "fill in the blanks". In a way it's the reverse of the also classic include.

    E.g.

    /WEB-INF/templates/masterTemplate.xhtml:

    
    
        
            
                <ui:insert name="title">Some title</ui:insert>
                    
        
    
        
    
        
            
        
    
        
    
    
    

    A page uses this as follows, e.g.

    /hello.xhtml

    
       hello
    
        
            Hi, this is the page
        
    
    

    0 讨论(0)
提交回复
热议问题