How can I display the username from the userindex page once the user successfully login. Should I be pass it to the constructor and use it? or is there any better solution for this?
How can I display the username from the userindex page once the user successfully
Share
Create a session-scoped bean that stores either the user’s ID (so you can lookup the user per request) or the actual user object itself.
Inject this bean wherever it is required. When you login and logout, call the appropriate methods above.
For example:
and in your page or template: