Freemarker converts Long into String with spaces between digits. How to fix?

Viewed 18

I use Freemarker for my Spring Application and faced an issue: Freemarker converts Long into String with spaces between digits.

For example (you may check it below), there is a category with id equals 1029, but in HTML it is converted to String equals "1 029". You may notice this in "<a href="/categories/update/1 029">" and "<td>1 029</td>". However it is expected to be "<a href="/categories/update/1029">" and "<td>1029</td>" respectively (without spaces).

Id column has Bigint variable type in DataBase.

Why is it so? And how could I solve it? I'm thankful for your advices!

Part of Categories.ftl

                    <#list categories as category>
                    <tr>
                        <td>
                            <div class="btn btn-group-sm" role="group">
                                <a class="btn btn-outline-primary" href="/categories/update/${category.id}">Update</a>
                                <form action="/categories/delete/${category.id}" method="POST">
                                    <button class="btn btn-outline-danger" type="submit">Delete</button>
                                </form>
                            </div>
                        </td>
                        <td>${category.id}</td>
                        <td>${category.title}</td>
                        <td>${category.createdDate}</td>
                        <td>${category.modifiedDate}</td>
                        <td>${category.user.username}</td>
                    </tr>
                    </#list>

Controller

    @GetMapping("")
    public ModelAndView getCategoriesPage(){
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.setViewName("categories");

        modelAndView.addObject("categories", categoryService.findAll());
        // Each category from DB is gotten here

        return modelAndView;
    }

Category.java

@Entity
public class Category {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    /* SMTH ELSE */
}

Here is HTML RESULT that I got in browser

Here is how it stored in DB

0 Answers
Related