Mariah
Mariah

Reputation: 1103

JSF expression language facecontext session

I want to know, if it is possible to access the session as

FacesContext.getCurrentInstance().getExternalContext().getSession(false);

from EL, the thing is I want to know if the user has login or not and make possible if?

Upvotes: 0

Views: 240

Answers (1)

BlindNW
BlindNW

Reputation: 415

There is an implicit session object available in EL as #{session} But it looks like returned session will under the hood be retrieved as follows:

return extCtx.getSession(true);

So, if you really need to get it from EL with false flag, you can put your code to method of some managed bean and call it.

Or you can call getSession from implicit request object:

#{request.getSession(false)}

Upvotes: 2

Related Questions