Questions tagged [jtwig]

JTwig is a modern Java template engine designed for web development.

Jtwig makes use of the common control flow constructs (used in almost all programming languages). Focused on providing power to the users, allowing them extend and customize the language, instead of providing features for all possible use cases.

26 questions
8
votes
4 answers

Java Spring MVC template Engine

What template engine is in Spring, which is similar to Blade in laravel? I am new to Spring, I searched templating engines, but have only found Jtwig, although it seems more a set of functions. I need that like blade, to generate templates with the…
6
votes
3 answers

Delete controller is not working

I'm really getting started with controllers for my small application, and i have this for now: @RequestMapping("/users/{id}") public ModelAndView showMemeber(@PathVariable Integer id) { ModelAndView mav = new ModelAndView("user/show"); …
user3697569
3
votes
1 answer

Java JTwig For Loop Using A Range Not Container

I want to be able to do the equivalent of the following loop using a JTwig template: for (int i = 0; i < length; i++ ) { ... } I have tried the following but neither seem to work: {% set k = 10 %} {% for i in 1..k %}
3
votes
0 answers

JTwig cannot launch

Hi I'm trying to set up a J2EE project using JTwig as a template engine but when I launch my app on the server I get this error : org.apache.catalina.LifecycleException: Failed to start component…
alex205_
  • 31
  • 3
2
votes
1 answer

How to get name of the Spring project in views?

I'm using jTwig templates and i have the following one:
user3697569
1
vote
1 answer

Upgrade to Java 17 throws java.lang.RuntimeException: Error creating extended parser class: Could not determine whether class has already been loaded

I am using jtwig lib and the code was working fine but when we upgraded to Java 17, I am getting the below mention runtime exception. Below is the method and throws RuntimeException while calling template.render() String renderDescription(String…
Rahul
  • 47
  • 7
1
vote
0 answers

Using UTF-8 in Jtwig with translation property-files

I have 4 locales in my resources folder which I'm loading exactly as shown in this example:…
emazzotta
  • 1,879
  • 3
  • 20
  • 31
1
vote
1 answer

Spring Security 4 JTwig put CSRF token in forms

How can i put CSRF token in form using JTwig? I tried this extension but it doesn't work (showing error about {% csrf %} has no endblock). Also i tried putting HttpServletRequest object in model and then get token using this snippet, but it had no…
1
vote
3 answers

How to invoke custom functions in JTwig?

Is it possible to invoke custom function (say static method) from JTwig template? For instance, in Thymeleaf framework I can call any static method via full name of its class. So I'm looking for something similar for JTwig.
Andremoniy
  • 34,031
  • 20
  • 135
  • 241
1
vote
0 answers

Javascript templating engine with twig embed-like functionality, does it exist?

I've been looking at javascript templating frameworks for the past day, but unless I missed something I can't seem to find a single one with the functionality I need. What I need is what twig calls "embed". Basically it works like a regular template…
1
vote
1 answer

Jtwig not processing the HttpServletRequest attribute

I am newbie to Jtwig, well I am facing an issue while creating Jtwig template that I am having interceptor class that is passing request attribute request.setAttribute("name","spring"); to the template and my jtwig template is not processing the…
Suleman khan
  • 1,038
  • 4
  • 14
  • 34
1
vote
1 answer

Jtwig How to obtain HttpSession / HttpServletRequest?

Recently began using Jtwig and have no idea how to easily obtain session, servletrequest, remote user and so on. In Thymeleaf, for example, it can be done that way: ...
VirtualVoid
  • 1,005
  • 3
  • 17
  • 25
1
vote
2 answers

UTF-8 encoding issue in Spring webapp with JTwig templates

We're using JTwig templating engine in our Spring webapp. It's great tool and has really nice features, but we have hit a wall with unicode content encoding using UTF-8. First of all, ViewResolver is configured in Java with: @Bean public…
Michlis
  • 107
  • 11
0
votes
1 answer

Shopware 6 Administration: how to override block inside sw-product-variant-modal

I try to override the sw_product_variant_modal_body_grid // index.js import template from './sw-product-variant-modal.html.twig'; const { Component } = Shopware; Component.override('sw-product-variant-modal', { template, computed: { …
rammi22
  • 271
  • 1
  • 11
0
votes
1 answer

Jtwig Current date function shows bad month number

I would like to display current date on my site using Twig. The problem is {{ "now"|date("Y-m-d") }} function which display me random month number like "2020-16-17". Every time when I rerun my Spring Boot program, the function shows different month…
Seldo97
  • 611
  • 1
  • 8
  • 17
1
2