I have used DI to inject a Stateful Session Bean across 3 servlets (which take data from forms across 3 JSP pages), so that data received by all 3 servlets can be stored in it. When I print all the data of the Bean in the last servlet, it gets printed successfully.
However when I try to print the same data of the bean on a JSP using <jsp:useBean>
tag, and scope=session
all data shows null. I tried using InitialContext to get the bean using JNDI but it could not find the required bean (probably because I injected the bean using DI!). I even tried putting the EJB bean in an HttpSession
but it threw a ClassCastException
.
How do I print the values of my Stateful Session Bean on a JSP?