Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Record as Back Bean property #1820

Open
hantsy opened this issue Jun 12, 2023 · 9 comments
Open

Support Record as Back Bean property #1820

hantsy opened this issue Jun 12, 2023 · 9 comments

Comments

@hantsy
Copy link

hantsy commented Jun 12, 2023

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}/>
@arjantijms
Copy link
Contributor

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.

@hantsy
Copy link
Author

hantsy commented Jun 12, 2023

I am not sure if this is just an EL binding work.

@arjantijms
Copy link
Contributor

Oh well, we can investigate it here first and see what's needed.

@tandraschko
Copy link

I think that must be implemented in BeanElResolver in el-specs

@BalusC
Copy link
Member

BalusC commented Jun 18, 2023

It's indeed in EL. See also https://balusc.omnifaces.org/2020/11/using-java-14-records-in-jsf-via-eclipse.html

@hantsy
Copy link
Author

hantsy commented Jun 19, 2023

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.

@tandraschko
Copy link

create a issue in EL specs

@pizzi80
Copy link

pizzi80 commented Sep 5, 2023

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?

@tandraschko
Copy link

thats up to EL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants