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
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<String, Object> and you can access your stored objects with the help of the get(Object key) method.
Map<String, Object>
get(Object key)