jWebForm icon indicating copy to clipboard operation
jWebForm copied to clipboard

Thymeleaf integration?

Open odrotbohm opened this issue 6 years ago • 3 comments

As Thymeleaf is the most popular template engine with Spring application these days it would be cool if there was some documentation about how to use jWebForm with it. Maybe a very thin Thymeleaf dialect that allows the declaration as follows:

<form th:web-form="${form}" />

That could hide away the interaction with the jWebForm APIs in the controller.

odrotbohm avatar Oct 29 '18 10:10 odrotbohm

Please have a look at this demo project, that uses thymeleaf and spring-boot-2:

Controller: https://github.com/jochen777/jWebFormSpringBoot2Thymeleaf/blob/master/src/main/java/com/example/springboot2thymeleaf/demo_thymeleaf/web/DemoController.java (I even wrote a unit-test for this! :)

Template: https://github.com/jochen777/jWebFormSpringBoot2Thymeleaf/blob/master/src/main/resources/templates/demo.html

Do you think, that this is clean enough? I don't want to dive too deep into Thymeleaf, if possible. (But to be honest: The rendering in java is mostly not the best way. It is better located in the template engine. BUT this can be done in a central, generic way and have to be done just once for all forms)

jochen777 avatar Oct 29 '18 22:10 jochen777

I think this one is ready to close :-)

n8himmel avatar Jun 19 '24 09:06 n8himmel

The sample is for an old unsupported version of Spring Boot. I couldn't run it with Spring Boot 3.3. It isn't anyway referenced in the docs for this project, so I would say the issue is still open.

dsyer avatar Jun 19 '24 10:06 dsyer