Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8620157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:30:59+00:00 2026-06-12T06:30:59+00:00

I would like to use a Facelets template within another template. Currently I have

  • 0

I would like to use a Facelets template within another template. Currently I have a “base” template that so far has been enough for all pages I’ve done. It has a top and a content area.

The top has logo, menu, login/logout functionality, while the content area shows, well, the content.

Now I need to do another page (to hold user profile information) where I’d like to have a menu to the left and show result to the right. This page shall be inserted in the base template content area.

Is it possible to create a new template which defines those two areas (profile_left and profile_content) and somehow still use the base template?

I see no reason why I couldn’t just copy the code in the base template and add the new “defines” that I want (profile_left and profile_content), but I still wonder if it’s possible to keep using the original base template.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T06:31:00+00:00Added an answer on June 12, 2026 at 6:31 am

    You can extend from templates as deep as you want. It’s not true that you can extend from only one template or something as you seem to think.

    For example:

    /WEB-INF/templates/base.xhtml

    <!DOCTYPE html>
    <html lang="en"
        xmlns="http://www.w3.org/1999/xhtml"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:ui="http://java.sun.com/jsf/facelets"
    >
        <h:head>
            <title><ui:insert name="title">Default title</ui:insert></title>
        </h:head>
        <h:body>
            <div id="header">Header</div>
            <div id="menu">Menu</div>
            <div id="content"><ui:insert name="content">Default content</ui:insert></div>
            <div id="footer">Footer</div>
        </h:body>
    </html>
    

    /WEB-INF/templates/profile.xhtml

    <ui:composition template="/WEB-INF/templates/base.xhtml"
        xmlns="http://www.w3.org/1999/xhtml"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:ui="http://java.sun.com/jsf/facelets"
    >
        <ui:define name="content">
            <div id="profile_left"><ui:insert name="profile_left" /></div>
            <div id="profile_right"><ui:insert name="profile_right" /></div>
        </ui:define>
    </ui:composition>
    

    /user.xhtml

    <ui:composition template="/WEB-INF/templates/profile.xhtml"
        xmlns="http://www.w3.org/1999/xhtml"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:ui="http://java.sun.com/jsf/facelets"
    >
        <ui:define name="title">User profile</ui:define>
        <ui:define name="profile_left">
            Profile left.
        </ui:define>
        <ui:define name="profile_right">
            Profile right.
        </ui:define>
    </ui:composition>
    

    See also:

    How to include another XHTML in XHTML using JSF 2.0 Facelets?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have some large strings that I would like use as test data
I have an array of Integers in Java, I would like use only a
I would like use a panel whose children have coordinates specified as percentage of
I have an AIR application and I would like use SQLite instead of an
I would like to do some more learning of facelets. Now that Java is
I would like use argparse to parse the arguments that it knows and then
I've got an JSP tag that I would like to use in my JSF/Seam
I would like post some message as another user (not currently using the app).
I would like to use JavaScript to manipulate hidden input fields in a JSF/Facelets
I have a JSF 2.0 application that I would like to start adding validators

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.