useBean functionality
i have a servlet centric architecture where i am creating a bean in the servlet and passing it to a jsp using the setAttribute() method.
MyBean myObject = new MyBean();
myObject.setProperty1(value);
myObject.setProperty2(value);
request.setAttribute( "obj", myObject );
once it gets to my jsp, i want to get the object and maintain its persistance throughout the scope of the session. to do this, i am TRYING to use the <jsp:useBean/> tag, but it is creating a NEW object and not retrieving the one passed by the servlet.
<%@ page import="myPackage.MyBean" session="true" %>
<jsp:useBean id="obj" class="MyBean" scope="session"/>
<%
if (null != obj)
System.out.println("bean is NOT null");
else
System.out.println("bean is null");
%>
according to "Web Development with JavaServer Pages" by Fields & Kolb, pg 226 - this should be possible. if it is NOT, can someone instruct me on how to maintain the objects persistance using getAttribute()? i would prefer to use the <jsp:useBean/> tag if possible, though.

