Let’s say that you have the following Facelet ( Using Facelets 1.1.12 ):
edit_item.xhtml which i access with edit_item.jsf
Now i have another page sending me to edit_item.jsf with the GET-paremeter ID the uri looks like this: http://mysite.com/edit_item.jsf?ID=200
How do you access a Bean and fetch the Information, and display this on the requesting page with JSF and Facelets? Is there a way to run a bean when a page loads?
You can use the
faces-config.xmlconfiguration to inject the ID from theparammap.For this simple bean:
You could inject the ID using this definition:
Facelets form:
This isn’t the only way to do it (you could look the ID up directly using the
FacesContextfor example).