-
Notifications
You must be signed in to change notification settings - Fork 76
Open
Labels
enhancementNew feature or requestNew feature or request
Description
I used to dream about auto-generating jakarta validation annotations into HTML input attributes. This way, both front-end and back-end could have same validation. Since JTE has extensions, I'm wondering if this is possible.
For example lets declare model like this:
import jakarta.validation.constraints.NotEmpty;
record DemoForm(@NotEmpty String firstname, @NotEmpty String lastname) {}And write jte template something like this:
@param DemoForm form
@form(form)
@form.input("firstname")
@form.input("lastname")
<button>Submit</button>
@endformThen compile time generates output:
<form>
<input name="firstname" value="${form.firstname()}" required="true" />
<input name="lastname" value="${form.lastname()}" required="true" />
<button>Submit</button>
</form>required="true" is generated because of @NotEmpty annotation.
Is this possible with JTE extensions?
knoppixmeister
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request