Questions tagged [freemarker]
Apache FreeMarker™ is a template engine: a Java library to generate text output (HTML web pages, e-mails, configuration files, source code, etc.) based on templates and changing data.
freemarker
3,098
questions
0
votes
0
answers
12
views
insert image in to docx freemarker template
The project uses java and Freemarker to create documents. The sequence of actions is as follows: a template (docx with freemarker markup) is loaded into the system, then the user selects the necessary ...
0
votes
0
answers
12
views
MJML with Freemarker
I want to user MJML with Freemarker in Java.
My template :
<mj-raw>
<#if ( typeDemande == "hydrocurage" ) >d'de</#if>
</mj-raw>
But When I compile (MJML 5):
...
0
votes
0
answers
12
views
Pass rest... parameters to child macro
What am I trying to do?
Based on the documentation, this is valid freemarker:
[#macro foo rest...]
[#-- do something with rest... --]
<div
[#list rest as key, val]
${key}="${val}...
0
votes
0
answers
15
views
Inject dynamic value from back-end in freemarker code of keycloak
Below is for keycloak 21. I have the below java class with a method that returns some dynamic data as "customCss" :
public class FetchCss {
private static final String API_URL = "...
0
votes
1
answer
20
views
Recursive function changes variable value of caller function
This is a POC code on freemarker recursive function call. The actual code is a bit complex.
Here when I call the above template, the function recursively calls itself. I initialize the temp variable ...
0
votes
2
answers
36
views
FreeMarker/NetSuite PDF Template - Double sorting by date, with possible empty values
I need to sort a list of records and render them in a table, but they have to be sorted by a "From Date" column, and then by "To Date" at a second level. I checked the ...
0
votes
0
answers
11
views
How can I assign a JSONArray object to a js variable via ftl?
//springboot
@RequestMapping("page")
public String goConfigPage(ModelMap modelMap, HttpServletRequest request) {
modelMap.put("configTypeList", JSONArray.toJSON(...
0
votes
0
answers
27
views
Keycloak executeAction.ftl template: action variable is undefined
I'm customizing the executeAction.ftl template in Keycloak to change the email content based on the action that triggered the email (e.g., UPDATE_PASSWORD, VERIFY_EMAIL). However, I'm facing an issue ...
0
votes
0
answers
12
views
enable intellij to link another ftl file on click
I use intellij Ultimate .
consider this ftl file :
intellij perfectly links the import and whenever I click on getBannerOrg() it takes me to the featureGetter.ftl file's getBannerOrg() method.
I do ...
0
votes
1
answer
26
views
TopDesk/ Freemarker ... condition on body not working
I have an action sequence in Topdesk. The first step is delivering a body (or not) ... the second step should only be executed if I have response in the previous step.
That's my response body from the ...
0
votes
0
answers
22
views
Issue with freeMarker generated email content
I have a freeMarker template .ftl file that has html + css styling code. This template gets the dynamic model data to replace the place holders during runtime. And after freeMarker processing I send ...
0
votes
1
answer
20
views
Freemarker, formatting date issue
The string is this one:
2024-05-08T09:55:57Z
And with this:
content?matches('[0-9]{4}-[01][0-9]-[0-3][0-9]T[0-2][0-9]:[0-5][0-9]:[0-5][0-9]([+-][0-2][0-9]:[0-5][0-9]d|Z)')
content?datetime?string['...
0
votes
0
answers
70
views
Liferay - Menu navigation - Breadcrumbs
I am working with liferay 7.4, I have created a navigation menu that contains Submenu, I need to group pages without having links.
I have created an ADT template to show that menu, the problem I have ...
0
votes
1
answer
297
views
Build a spring boot based webhook consumer service
I have a requirement to build a spring boot based webhook service which can consume request bodies in either JSON or XML in any format.
For eg: we onboard a customer who already has a fixed JSON ...
0
votes
2
answers
41
views
Why Freemarker Template is not parsing the xml with namespace
my earlier question answered here
How to separate XML tags in freemarker in body function
But my xml is coming with namespace, But when i am trying to add the namespace in template its not parsing my ...
0
votes
1
answer
182
views
Deploying Keycloak template breaks the server (Migration to Quarkus)
I'm trying to migrate a custom template from pre-Quarkus to Keycloak Quarkus (24.0.1).
It is located at <KEYCLOAK_HOME>/themes/base/login/consent-required-action.ftl.
The template looks as ...
0
votes
0
answers
53
views
How to pass sensitive data from FreeMarker to JavaScript without exposing it in the browser
I'm getting a secure private key by executing server-side function in freemarker template. I have to pass the private key to other javascript file but the key is exposed in the DOM during the initial ...
0
votes
1
answer
49
views
in netsuite advanced pdf im looking to put an asterisk next to my date in my customer statement if the date has elapsed
In oracle NetSuite advanced pdf I've being trying to put an asterisk next to a date. With the current free marker I have, the calculation for daysoverdue gt 0 does not work. If I were to take out the ...
0
votes
2
answers
38
views
Boolean expression if false not working with ?? in freemarker
<#function kafkaCacheBackupLoaderProfiles>
<#assign profiles = []>
<#if featureEnabled.createCacheLoader??>
<#assign profiles = profiles + ["kafka-cache-loader"]&...
1
vote
1
answer
32
views
How to separate XML tags in freemarker in body function
I am trying to write a freemarker function to parse xml but i want to avoid the specific XPATH set from the xml.
The below freemarker is working if the xml does not have DOCUMENT_SETS . But my xml ...
0
votes
1
answer
120
views
Iterating Over Object Keys in Freemarker Templates with SuiteScript 2.1 Custom Data Source
In my Suitelet script I add custom data source to renderer. In Freemarker Template I am able to access the data. I am also able to list all the arrays of custom data source. Problem is, I cannot seem ...
0
votes
2
answers
31
views
How to escape Freemarker output of captured assign?
I want to escape the output of a variable, that used the capture syntax of a <#assign> in Example 2.
Example 1:
<#assign test1='{"json": "more"}' />
<div data-test1=&...
0
votes
0
answers
179
views
Struts 6.x migration issues with sitemesh
I am trying to migrate a working project from Struts-core 2.5.30 to 6.3.0.2 running on a JBoss EAP 7.4. Meanwhile i am using struts2-convention-plugin, struts2-oval-plugin, struts2-json-plugin, ...
0
votes
0
answers
64
views
I want to custom webauthn-register.ftl using React Keycloaktify, but in Keycloaktify not supported webauthn-register.ftl
Im trying to customize keycloak theme spesific webauthn-register.ftl using Keycloaktify. But in the documentation, Keycloaktify does not yet provide a custom webauthn-register.ftl
Im trying convert ...
0
votes
0
answers
37
views
project in intellij not getting imports from other submodules after generating code via freemarker
this is my project structure for module check-services. check-services has submodules check-services-core,<-- check-services-core-domain,<-- check-services-common-domain. All the code is ...
1
vote
1
answer
2k
views
Struts 2 to Struts 6 Migration
Struts 2.5.34 to Struts 6.3 Migration
We've our application currently in struts 2.5.3 version.
As Apache announced EOL for this, we are upgrading to Struts 6 (6.3 to be exact) using official ...
1
vote
1
answer
218
views
Why escape in Struts tags doesn't work after upgrade to Struts 6.3.0.2
If I have a Struts 2 tag as below
<s:optiontransferselect
leftTitle="<strong>All system groups</strong>">
</s:optiontransferselect>
The resulted outcome should ...
0
votes
1
answer
160
views
Netsuite Customer Statement (PDF/HTML) - trying to insert posted code to display lines from invoice - but getting errors
Simon G posted this answer to display lines from an invoice showing paid amounts on the customer statement and posted this code below, but when I try to insert it into the customer template at the ...
0
votes
0
answers
146
views
Embed a nextjs - react component into another app using a script
I'm trying to create a microservice in nextjs and react so I can use it in a Hippo-CMS application based on Java and Freemarker.
Is this possible?
I have created a react only project (I have not ...
0
votes
2
answers
198
views
Unable to import a .ftl file inside my .ftl file - freemarker
i am trying to templatise my java class using freemarker.
My config bean is :
@Bean
public FreeMarkerConfigurer freeMarkerConfigurer() {
FreeMarkerConfigurer configurer = new ...
0
votes
2
answers
70
views
Freemarker - disable Syntax validation?
Is there an option to disable the ParseException?
I would have a HTML String which has an issue in the Syntax?
The HTML String is created from my user, therefore there might be cases that the syntax ...
0
votes
0
answers
112
views
NetSuite Advanced PDF/HTML Template: How to remove first line from free-format text field
I was wondering if anyone can assist on how to do this?
Custom field: ${check.custbodysubsidiaryaddress} (Free-format text field)
Actual Output:
Sarah Sheppard
221 Lakeshore Drive
Barrie, ON M6B4B7
...
0
votes
1
answer
104
views
Convert string to JSON object using freemarker template
<#assign loanInformation = '{"8":{"loanId":"8","employeeId":"7","loanType":"1","totalAmount":"100000","...
0
votes
0
answers
70
views
How to sort null bin items at last in netsuite advanced pdf template?
I created a Picklist using Advanced PDF in NetSuite. I want the items to be sorted out based on the BIN Number. Now items with blank bin number are coming first. Is there a way to sort the items last ...
0
votes
0
answers
30
views
need to resolve Whitelabel Error with springboot and freemarker templates
I'm new to framemaker and have tried to run this sample project and I'm getting a Whitelabel Error message when I try to access http://localhost:8081/index. In the console the exception is:
javax....
0
votes
0
answers
12
views
How to reference a css file in a Spring boot project whose views have a .ftlh extension?
Project to develop an advertisement website. Wrote a standard base for an MVC project. As soon as we talk about adding frontend to the code, the browser does not see it. A link to the css file is ...
0
votes
1
answer
116
views
Registration template not overriden in Keycloak 21
In my custom registration object i have this code:
@Override
public void buildPage(FormContext context, LoginFormsProvider form) {
logger.info("Starting custom form...");
...
0
votes
1
answer
25
views
how to create a new filtered sequence from another
If I have a sequence like:
<#assign seq = ['a', 'b', 'c', 'd', 'e']>
I'd need to obtain some new sequences that are filtered versions of the original one. For example:
<#assign seq1 = ['a', '...
1
vote
1
answer
145
views
org.apache.jasper.JasperException: An exception occurred processing [/jsp/include/actionError.jsp] when updated to struts 6.3.0.2
org.apache.jasper.JasperException: An exception occurred processing [/jsp/include/actionError.jsp] at line [61]
58: </c:when>
59: <c:otherwise>
60: <t:actionmessage ...
0
votes
0
answers
85
views
Freemarker template not found exception in Quarkus
After followed the official documentation and others tutorials, when I run my quarkus 3.6.4 app I get the error:
2024-01-12 10:02:11,412 ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] (executor-thread-...
0
votes
1
answer
120
views
Freemarker if statements inside html elements
I have some liferay templates I am attempting to convert from velocity to freemarker.
The old code had some if statements inside html elements. For example:
<a href="url" #if (condition) ...
0
votes
1
answer
36
views
import spring.ftl cannout found
i'm upgrade my project from old boot 1.x to 2.3.12, and almost done but one thing is make problem.
In this project i used freemarker, so upgrade boot and used starter-freemarker.
server is going right ...
0
votes
1
answer
43
views
Freemarker: Combining macros and functions
For a specific use case, I need the functionality of a function that can also write output. I can't use macros because my functions return values. Is there a possibility that either functions generate ...
1
vote
1
answer
101
views
Listing Scala Map values inside FreeMarker template fails
I am using Freemarker v 2.3.32 and trying to list out the values of a map inside a free marker template. But my unit test fails with the following error:
freemarker.core....
0
votes
0
answers
40
views
How to handle empty xml node in freemarker
I am trying to parse an xml to json using freemarker . Its working if the mentioned tag is there in the input XML but getting an error if the tag itself is not there . In this case getting error if ...
1
vote
2
answers
42
views
Could not read repeated tags value from XML using Freemarker
I am trying to create a Freemarker program to convert XML to JSON . I am not able to read values from the list of values from the repeated tags of a xml .
Am not able to figure out why i could not ...
1
vote
2
answers
125
views
Freemarker equivalent of typescript optional chaining "?"
Typescript has a nice operator ? (called optional chaining) that check empty attributes in chains of dots.
Example
x?.y?.w?.z
means (more or less)
if (x !== undefined && x !== null &&
...
0
votes
1
answer
61
views
FreeMarker ?? operator treats missing value and false equally
Using FreeMarker, faced such a thing. ?? operator treats missing value and false. For example, the following
<#assign someVar = false>
<#if someVar??>
someVar exists!
<#else>
...
0
votes
1
answer
162
views
FreeMarker template evaluates all what is in expressions to null or missing
every help is appreciated. I cannot find mine's mistake I did. A template is not more processed by FreeMarker at first "${error}". I read documentation and compared with others. But it ends ...
0
votes
1
answer
373
views
How to group and sort items in netsuite advanced pdf template?
In netsuite advanced pdf template to print sales order pdf,
I am getting output for club type and club sub type as:
Club Type
Club Sub type
Iron
5 Iron
Putter
6 Putter
Wood
Wood 5
Wedge
Wedge 2
...