How to save an object into JSF Session

前端 未结 1 342
無奈伤痛
無奈伤痛 2020-12-20 08:30

I try to save the object into sessionmap but it is giving me an exception

public class testclass {

public static void main(String[] args) throws IOException         


        
1条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-20 09:01

    If you want to store an object in jsf session do the following:

    FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("yourKey", yourObject);
    

    The SessionMap is a Map and you can access your stored objects with the help of the get(Object key) method.

    0 讨论(0)
提交回复
热议问题