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

  • SEARCH
  • Home
  • 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 927149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T19:48:14+00:00 2026-05-15T19:48:14+00:00

I want to create a master template that every other view page will inherit.

  • 0

I want to create a master template that every other view page will inherit.

So the master template will have:

HEADER
--CONTENT--
FOOTER
  1. the header will optionally show (if the user is logged in), the username and other user object properties.

  2. the –CONTENT– is a placeholder that other ‘inheriting’ view pages will inject their content into.

So my questions are, is this possible with freemarker? If so, any guidance?

How would I pass the user object to the header from my controller actions? ideally the object would be passed in somewhere OTHER than each and every view page (to avoid having to maintain this code on each and every view page).

  • 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-05-15T19:48:15+00:00Added an answer on May 15, 2026 at 7:48 pm

    Yes, it’s possible. In our applications things like the user object exist in session scope, but this could be any scope freemarker has access to:

    <#if Session.the_user?? && Session.the_user.loggedIn>
        <#-- header code -->
    </#if> 
    

    You can omit the Session. and Freemarker will search the various scopes for the given variable name.

    To inject the content, include this at the point in the master template where you’d like the view page to put its content:

    <#nested>
    

    The view pages then declare their use of the master template as follows:

    <#import "/WEB-INF/ftl/path/to/template/master.ftl" as com>
    <@com.template>
        View page content
    </@com.template>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a master template for my app , page 0 and every page
I want to create a git branch that will work independent of the master
ASP.NET MVC 2 project. I want to create a master page that has three
I want to create a custom Apache2 log handler, and the template that is
I have an item template that I did wrong and want to delete. I
I want to create a common header user control for various master pages in
I've created a Master-Detail Application with Xcode 4.3. In the Master View I want
I want create wordpress website into which I want create user management... That means
i want create a custom json data from the mssql 2008 results so that
i want create image animation , i have 50 images with png format now

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.