Hi,
I have a component called loginAction like this :
@Stateless
@Name("loginAction")
@Interceptor(SeamInterceptor.class)
public class LoginAction implements Login, Serializable {
...
I can see that component is loaded to Seam as it prints out this:
13:18:24,095 INFO [Component] Component: loginAction, scope: STATELESS, type: STATELESS_SESSION_BEAN, class: com.basamadco.opxi.manager.logic.LoginAction
But when I want to load the component in my jsp, via this code:
<%
WebSessionContext webSessionContext = (WebSessionContext) Contexts.getSessionContext();
webSessionContext.set("username", session.getAttribute("j_username"));
webSessionContext.set("password", session.getAttribute("j_password"));
Context statelessContext = Contexts.getStatelessContext();
LoginAction loginAction = null;
System.err.println("Login is " + statelessContext.get("loginAction").getClass());
loginAction = (LoginAction) statelessContext.get("loginAction");
loginAction.login();
response.sendRedirect("main.html");
%>
Seam generate a NullPointerException. As it cannot fetch loginAction from context. I triedn Interception.ALWAYS and the problem remain.
java.lang.NullPointerException
at org.apache.jsp.init_jsp._jspService(org.apache.jsp.init_jsp:58)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
Any help?