I’m using JSF 2.0 framework and I need help. To put it as simple as I can, what I need is to get a user’s username and id and display it in the application I’m building.
This is my UserBean class:
@ManagedBean
@SessionScope
public class UserBean implements Serializable {
private static final long serialVersionUID = 1L;
private int id;
private String username;
private String password;
//getter and setter methods
At the index.xhtml page, the user needs to enter the username and password in order to login(comparing values from database). When he does, I want to output his username and id on the next page and keep track of that throughout whole application.
as username and id are in the session scoped bean. you can get them from the session map like this.
page2.XHTML
EDIT
you get the session data (username and id in this case) in the constructor and assign them to your attributes which you use in your page2.xhtml
lemme know if it helps…