I am assuming somethings here... if I am wrong... disregard

ASSUMPTIONS:
1. the usebean is in ur jsp A which has a form which submits a request
2. the the request is posted to a controller... say a servlet B.

now taking the http action into account a new request object is created when
u do a post or a get operation.... so by the time when u post to the
controller the bean has lost its instance...

if u did something like this..
<code>
<jsp:usebean scope="request"...../>
//then
//forward to the servlet...... the request scope remains.... else it is lost
//for ex.
request.sendRedirect("/B");
</code>

REMEMBER>>>>>a request scope is lost
1. after u send a response back.
2. u dont forward the request forward.

Hope that helps
Amit

-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:JSP-INTEREST@;JAVA.SUN.COM]On Behalf Of Joel Carklin
Sent: Tuesday, October 29, 2002 2:50 AM
To: [EMAIL PROTECTED]
Subject: Basic jsp:useBean question


Hi,

if I use the following tag in my jsp:

<jsp:useBean id="myBean" scope="request" class="package.name.myBean" />

When I click on the submit button on my form, the 'request'
is POSTED to a 'controller' jsp, which passes the 'request' onto a
request handler class.
I expected that if I called request.getAttribute("myBean") from either
the controller jsp or the request handler class, I would get the myBean
instance created by the useBean tag above. But I always get null??

thanks
Joel

===========================================================================
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://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

===========================================================================
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://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to