Hello.
I have a
JSP with this USEBEAN-tag:
<jsp:useBean id="MyCommandBean" class="mypackage.MyCommandBean" scope="session" />
The called
servlet have this:
private javax.servlet.ServletContext cx;
mypackage.MyCommandBean MyCommandBean=null;
MyCommandBean = (mypackage.MyCommandBean)
cx.getAttribute("MyCommandBean");
if (MyCommandBean == null)
{
MyCommandBean=(mypackage.MyCommandBean)
java.beans.Beans.instantiate(
getClass().getClassLoader(),"mypackage.MyCommandBean");
}
request.setAttribute("MyCommandBean", MyCommandBean);
My question is this:
Why is MyCommandBean always null when the servlet is invoked from the JSP ?
I thought that the scope "session" made the Bean mentioned in the USEBEAN-tag stay in the servlet context.
Is there a way I can do a request.setAttribute - command in the JSP ?
My problem is that all the information in the CommandBean is lost when the JSP calls the servlet.
Can anyone help me ?