如何在JSF托管bean中检索会话ID值?
发布于 2009-04-21 13:26:39
FacesContext fCtx = FacesContext.getCurrentInstance();
HttpSession session = (HttpSession) fCtx.getExternalContext().getSession(false);
String sessionId = session.getId();
发布于 2019-02-13 23:15:08
你试一试
{String uuidFc =String}
此行返回facesContext sessionId值
发布于 2022-02-16 16:07:14
您也可以使用OmniFaces JSF utility library。
String sessionId = Faces.getSessionId();
添加这个作为答案,因为如果您使用JSF,您很可能会使用这个库。
https://stackoverflow.com/questions/772541
复制相似问题