I am creating a JSF application. I have some elements (e.g. products) from a database, and I want to create a JSF page to edit individual elements, namely:
- it should display the selected properties of the element and allow the user to edit them,
- I want to be able to view this item using some link,
- I want JSF to somehow remember that I am editing a specific element (for example, after editing its data, it should display this page).
I have a problem with storing / passing the id of the element being edited. I saw that in the sample JSF CarDemo application they store the item (car) viewed in the session. I donβt want to do this because I want the user to be able to edit different elements in separate browser tabs.
I tried several approaches:
- using some
itemIdGET parameter (for example, ) in the URL, but this makes it difficult to return to the page of the element after editing the data (the field to-view-idin faces-config.xml can contain only constants), - using some backup bean of a managed property and passing its value in each hyperlink and in forms (by adding a hidden field)
, - , , , (, f:validateLength) , , . , - (, , ), - .
.