When a user logs into my website I want to display a div with a user menu, that contains his inbox, notifications, etc. Do I have to use JAAS with JSF to accomplish this? What’s the best way to do it? If you could point me in the right direction or maybe some tutorial, or if there’s some fancy way to do this instead of using the render attribute. Thanks in advance.
Share
If your security requirements are not complicated, a simple way of doing this without Jass is by using a session scoped bean for the user details.
The div in which you present the logged in\ logged data to the user will be controlled by this bean.
you will not have to use render, depending on what you wish to display to the user.
for example, a message to the user can be displayed always as
even if the user is logged out.
I would however consider using the render attribute.
Hope this helps
Added a simple example of session bean.
you can add details to the bean however I would suggest adding the minimum needed.
from this bean you will be able monitor the user.
from java:
from jsf files, using render on its attributes. i added getLoggedIn method as an example.
java class:
faces config: