Hi,

PLEASE, ignore my previous mail.

-------------

I agree, if the bean is declared with USEBEAN tag in each (applicable) page with 
"session" scope then the same bean exists for that session.

But, i don't see that the latest value is getting passed from one page to another 
where the bean is declared using USEBEAN tag with "session" scope.

Example
=======
Assume i have 2 jsp pages (say JSP1.jsp and JSP2.jsp)

In JSP1.jsp
----------------
<USEBEAN NAME="beanId" TYPE="JSP_JAVABEAN.BeanTest" LIFESPAN="session" >
<SETONCREATE BEANPROPERTY="userid" VALUE="INIT-NAME">
<SETFROMREQUEST BEANPROPERTY="*">
</USEBEAN>

<%      HttpSession hs = request.getSession(true); %>
<h1> USER_ID-1 is : <DISPLAY PROPERTY="beanId:userid"></h1>
<%      beanId.setnew(); %>
<h1> USER_ID-2 is : <DISPLAY PROPERTY="beanId:userid"></h1>
<a href=http://3.209.128.129:80/NASApp/JSP_JAVABEAN/JSP2.jsp> CLICK </a>


Where beanId.setnew() sets the "userid" from INT-NAME to NEWNAME


In JSP2.jsp
----------------
<USEBEAN NAME="beanId" TYPE="JSP_JAVABEAN.BeanTest" LIFESPAN="session" >
<SETONCREATE BEANPROPERTY="userid" VALUE="INIT-NEW-NAME">
<SETFROMREQUEST BEANPROPERTY="*">
</USEBEAN>

<h1> USER_ID-1 is : <DISPLAY PROPERTY="beanId:userid"></h1>

Hear the same bean is declared with Session scope.
Actually, the does not get initialized.
But, still i have "userid" as INIT-NAME and not NEWNAME.

It will be great if you can point me where i am doing mistake.

Thanks... R. Bala


-----Original Message-----
From:   Lee Collins [SMTP:[EMAIL PROTECTED]]
Sent:   Friday, March 17, 2000 3:53 AM
To:     [EMAIL PROTECTED]
Subject:        Re: Need Urgent Help needed regarding JSP & Beans

Vinay,

Did you specify a scope??
<jsp:useBean id="my_class" class="my.class" scope="????" />

If you set the scope to 'session', then when a user goes from page to page
he will recieve the SAME BEAN. A new bean will NOT be instantiated.

If ALL users wish to view/modify the bean then you probably want
scope='application'.

I don't know what the default is but it seems like scope='session' is what
you want.

Lee

>From: Vinay Kulkarni <[EMAIL PROTECTED]>
>Reply-To: Vinay Kulkarni <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Need Urgent Help needed regarding JSP & Beans
>Date: Thu, 16 Mar 2000 12:54:23 PST
>
>HI Guys,
>
>I need some urgent help.
>
>I have a 3 JSP pages. In all the three JSP pages I am instantiating the a
>bean. The bean is used to set & get a value.
>Now From the 1st page I set some value by calling a set method from the
>bean. Now when I go to the second or third page & try to get the value set
>by using the get method, I am not able to see the value. The value is lost
>due to instantiating the bean once again in the second page.
>
>Please can anyone help me asto how can I retain the value in the second
>page.
>
>
>Thanks in advance.
>
>
>Vinay
>______________________________________________________
>Get Your Private, Free Email at http://www.hotmail.com
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
>JSP-INTEREST".
>Some relevant FAQs on JSP/Servlets can be found at:
>
>http://java.sun.com/products/jsp/faq.html
>http://www.esperanto.org.nz/jsp/jspfaq.html
>http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to