faces
faces copied to clipboard
Support Record as Back Bean property
Assume we have a backing bean like this.
@ViewScoped
@Named("todosHome")
class TodosHome{
private TodoForm form;
// setters and getters.
}
And TodoForm
here is a record
.
record TodoForm(String title){}
In the faceslets xhtml page, it should can be bound to a html form.
<input jsf:value="#{todosHome.form.title}/>
Sounds good. Let's see what we can do to support this. My gut feeling says it's an Expression Language issue and not directly something Faces does.
I am not sure if this is just an EL binding work.
Oh well, we can investigate it here first and see what's needed.
I think that must be implemented in BeanElResolver in el-specs
It's indeed in EL. See also https://balusc.omnifaces.org/2020/11/using-java-14-records-in-jsf-via-eclipse.html
It's indeed in EL. See also https://balusc.omnifaces.org/2020/11/using-java-14-records-in-jsf-via-eclipse.html
It can not bind values from a HTML form.
There is no copy method like the Kotlin data class, ideally when set a new value, create a new instance and copy values from the old instance.
create a issue in EL specs
Jakarta EE 11 will be Java 21+ and will include Jakarta Persistence 3.2 which has support for java records
https://jakarta.ee/specifications/persistence/3.2/
... Did someone forgot to align the specs with the "web" tier?
thats up to EL
Currently already implemented in EL 6.0 as per https://github.com/jakartaee/expression-language/issues/201