stacker
stacker

Reputation: 68962

How to store currently logged on user in DB?

Using Seam 2.1.2 and JSF 1.2 I wonder how to store the users login name in the database.

In plain JSF I would simply lookup FacesContext.getCurrentInstance().getExternalContext().getRemoteUser();in a backing bean and set the value into a persistent object.

How can I achieve that the users name will be stored in the DB?

Upvotes: 2

Views: 194

Answers (1)

Arthur Ronald
Arthur Ronald

Reputation: 33785

You can inject a Credentials component

private @In Credentials credentials;

So retrieve your logged user by using

credentials.getUsername();

Upvotes: 1

Related Questions