Closed tschuehly closed 1 year ago
That should work, for instance:
override fun writeTo(output: TemplateOutput) {
output.writeContent("<div id=\"")
output.writeContent(uuid.toString())
output.writeContent("\">")
(jteTemplateEngine as TemplateEngine).render(getTemplate(this), getAttributes(this), output)
output.writeContent("</div>")
}
Thank you @casid it works nicely!
In Spring ViewComponent I render nested ViewComponents with the Content type.
A ViewComponent returns a record/data-class that implements the ViewContext Interface
The ViewContext interface implements the gg.jte.Content interface and overrides the writeTo function.
For nested components that are rendered directly in a template I want to embed them automatically in a div that has an ID attribute to get a similiar behaviour as my thymeleaf implementation:
I would like to do this at runtime, as this needs to generate a new UUID to the ID as the component can be multiple times on the page. Is this possible somehow?