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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:55:51+00:00 2026-05-23T01:55:51+00:00

How can I add some freemarker macro (<#macro myMacro>…) in java jar library and

  • 0

How can I add some freemarker macro (<#macro myMacro>…) in java jar library and after than use it (<@macro myMacro/>) in my other web projects?

  • 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-23T01:55:52+00:00Added an answer on May 23, 2026 at 1:55 am

    Step 1: embed a template file in your JAR library with a macro, e.g. a file foo.ftl with a macro bar.

    Step 2: configure FreeMarker so that it can load templates from that JAR library. One way to do this is registering a ClassTemplateLoader, either by calling Configuration.setClassForTemplateLoading or by directly registering a ClassTemplateLoader (see FreeMarker documentation about template loading). Alternatively you can try to use a URLTemplateLoader or call Configuration.setServletContextForTemplateLoading, depending on your use case.

    You maybe even have to combine such a ClassTemplateLoader/URLTemplateLoader with your currently used template loader in order to load templates from more than one location (see MultiTemplateLoader).

    Step 3: import the macro template file into a namesapce from your main template via the import directive, e.g.

    <#import "foo.ftl" as foo>
    

    Step 4: call the macro via its namespace, e.g.

    <@foo.bar />
    

    Done!

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

Sidebar

Related Questions

How can I, in Java or using some other programming language, add a new
Can I add Java portlet in sharepoint 2007? If yes, can some please explain
After a page is loaded a user can add some text and with every
I was trying to add some configuration in web.config file after the web page
I know I can add service behaviors with some XML configuration, but I'd like
How can i reset a display:none and add some value here is the code
Can I adjust the ASP.NET Membership Tables to add some columns of my own?
If I create a UserControl and add some objects to it, how can I
I have form, where some fields are looks like rows, so I can add/delete
How can I add a scrollbar to the wrappanel control in WPF. Some of

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.