Answer the question
In order to leave comments, you need to log in
How to remove white space in a string in freemarker templating engine?
Created a DAO table in which the primary key is the id attribute, respectively, in Entity it is specified as a Long type.
Then I pass this id to freemarker, in it id is part of the link, example: a href="/newMessage?message=${message.id}">
When id<1000, then everything works as it should, i.e. id is displayed as it should be (XXX).
As soon as id >1000, there is a space between thousands and hundreds (X XXX). And already in this form, the id is inserted into the link. Clearly, in this form, id is not needed there, to put it mildly.
How to get rid of this gap?
at the input of the freemarker (in the controller), Long is accurately transmitted, debugged. Tried replace: ${message.id?replace(" ", "")}, tried replace with regular expression.
Wasted a lot of time on this crap.
Answer the question
In order to leave comments, you need to log in
Try explicitly setting the number format<a href="/newMessage?message=${message.id?c}">
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question