Arun Thomas wrote:
>
> Hi Darcie,
>
> Note that in line 6 (counting down in the Initial Page example below), you
> use the JSP usebean
> tag to create a Person. That tag is transformed (in the generated servlet)
> into something like this....
>
> com.silknet.ebiz.silkmodels.BusinessObject Person = new
> com.silknet.ebiz.silkmodels.BusinessObject();
> session.putValue("Person", Person);
>
> At this point, the Java reference object Person points to the same object as
> the session Value with key "Person"
>
> In line 15 (again in the same example), you do the following:
>
> Person = Contact.searchEntity("Parent");
>
> You have just changed the object to which the Java reference object points.
> The item stored in the session, however,
> is the original object created by the usebean tag.
>
> In this case, you probably don't want to use the usebean syntax, but rather
> add a session.putValue to your scriptlet.
>
> -AMT
>
> P.S. I use the term "Java reference object" above. I don't know if this is
> a correct usage - I just made up that
> phrase because I don't know what else to call them (I'm sure an official
> name exists, but....) I hope it didn't
> cause confusion.
Yes, of course. Please ignore my previous answer. Arun is right, I missed the
fact that you didn't actually set the property in the Person instance created
by the useBean action.
> > -----Original Message-----
> > From: A mailing list about Java Server Pages specification and reference
> > [mailto:[EMAIL PROTECTED]]On Behalf Of Darcie Huntress
> > Sent: Monday, January 17, 2000 2:32 PM
> > To: [EMAIL PROTECTED]
> > Subject: Problem using bean with scope="session"
> >
> >
> > On my starting page, I have instantiated a bean with scope="session" and
> > called it "Person". On this initial page, I can call its method
> > "getPropertyValue" and see valid data. When I create another page (which
> > gets loaded after this initial page, so no race condition should
> > be created)
> > I am having problems being able to reference "Person". I have tried what
> > seems like every possible combination of attributes... what am I doing
> > wrong?
> >
> > Example -- Initial Page:
> > ----------------------------------
> > <%@page language="java"
> > import="com.silknet.ebiz.silkmodels.BusinessObject"
> > errorPage="errorpage.jsp"%>
> > <jsp:useBean id="Contact" scope="session"
> > class="com.silknet.ebiz.silkmodels.BusinessObject"/>
> > <jsp:useBean id="Person" scope="session"
> > class="com.silknet.ebiz.silkmodels.BusinessObject"/>
> > <%
> > String eKey = request.getParameter( "key" );
> >
> > Contact.setName( "Contact" );
> > Contact.setKey( eKey );
> > Contact.getData();
> >
> > Person = Contact.searchEntity("Parent");
> > out.println( Person.getPropertyValue( "lastName" ) );
> > %>
> >
> > Subsequent page:
> > --------------------------
> > <%@page language="java"
> > import="com.silknet.ebiz.silkmodels.BusinessObject"
> > errorPage="errorpage.jsp"%>
> > <jsp:useBean id="Person" scope="session"
> > class="com.silknet.ebiz.silkmodels.BusinessObject"/>
> >
> > <%
> > out.println( Person.getPropertyValue( "firstName" ) )
> > %>
> >
> >
> > I get "null" back for the value, and the page is compiling with no errors.
> > I am using JSWDK 1.0.1.... could I have a configuration problem,
> > perchance?
--
Hans Bergsten [EMAIL PROTECTED]
Gefion Software http://www.gefionsoftware.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html