You ALSO need the line:
<jsp:useBean id="MyBean" class="MyClass" scope="session"/>
on page 2 before the getProperty line.
That's how you tell page 2 that the bean is available in session scope.
By the way: to follow common style guidelines, your bean id should not be
capitalized. Capital names are for classes. So you should use:
<jsp:useBean id="myBean" class="MyClass" scope="session"/>
<jsp:setProperty name="myBean" property="someProperty" value="someValue"/>
-----Original Message-----
From: Hamid Mukhtar [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 09, 2001 11:13 AM
To: [EMAIL PROTECTED]
Subject: Session scope
Hi JSP developers,
I've got a question:
Suppose, I want to use a bean for session scope.So I write in page
1:
<jsp:useBean id="MyBean" class="MyClass" scope="session"/>
<jsp:setProperty name="MyBean" property="someProperty" value="SomeValue"/>
Then I can click on a link on page1 which refers to page 2, where I use:
<jsp:getProperty name="MyBean" property="someProperty"/>
However the bean is not recognised there, and generates error.
Is this approach correct for using a bean for session or there is
some
error. Please help me(or provide some reference/url).
Thanks,
Hamid Mukhtar
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
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".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
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