简体   繁体   中英

Getting Session information in EJB?

I have two questions:

  • Is it good approach to get http session information in ejb?
  • How can i get Http Session information in EJB tier?

Context

I have application in which I have two types of pages, jsp pages and jsf pages, now am getting session information in jsp page and i want to pass this session information to jsf backing bean because from backing bean am calling ejbs and needs session for setting up all remote and local interfaces for ejb.

不,尤其是因为通常不通过HTTP调用EJB。

HTTP Session information cannot be availed from EJB's readily. However, Session being Session, you should be able to retrieve values from it, irrespective of it being a JSP or a JSF.

To retrieve a Session attribute in JSF by doing

<h:outputText value="#{sessionScope['id']}" />  

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM