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 4061426
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:28:00+00:00 2026-05-20T15:28:00+00:00

In freemarker, I’m looking to include an existing template from within another repetitively. The

  • 0

In freemarker, I’m looking to include an existing template from within another repetitively. The existing template assumes it’s looking at the top of the value stack. I’m really looking for an ‘apply’ function. So I have a parent template:

<#list items as item>
<#include "/my/subtemplate.ftl"/>
</#list>

How can I make the subtemplate see item as the top item on the value stack, so that I don’t need to copy it and change every reference to ‘property’ on the item to item.myproperty?

  • 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-20T15:28:01+00:00Added an answer on May 20, 2026 at 3:28 pm

    just confirming “stack” is a reference to the ValueStack object placed into the template’s context by the Struts2 framework. It doesn’t exist outside Struts2.

    In FreeMarker, an included template shares the state of the including template, such as the data model and the template language variables. Unfortunately, there is no push or pop of the context like this to change the included template’s context. You can use <#assign> or <#global> to place variables in the scope of the template, but these won’t replace shared template data model.

    In plain FreeMarker, I think you’d refactor the subtemplate into a macro or function and <#import> it, passing item in as an argument.

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

Sidebar

Related Questions

Attention advanced Freemarker gurus: I want to use a single freemarker template to be
I'm trying out FreeMarker, not for a web application but to generate text within
Problem Detail: In itemCheckout.ftl (freemarker template) I have a drop-down box with check-box associated
I have a web application that I need to manually obtain a Freemarker template
Using freemarker , is there any way to reference a value indirectly along the
This is a piece of my freemarker template: ${order.needByDate?if_exists?date} I want it to work
I'm currently working on a project were we use freemarker as a template language.
I'm writing a JS Array of objects in a Freemarker template. But I am
How to get the request context path in freemarker template when using with spring
I have a Freemarker template which contains a bunch of placeholders for which values

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.