Joel Carklin wrote:
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??
It sounds like if you have the <jsp:useBean> action in the JSP page
that contains the form, but try to access the bean in pages that
are invoked when you submit the form. That doesn't work, because the
form submit starts a _new_ request, so the old request scope is gone:
Client Server
------ ------
GET /foo.jsp --> Executes foo.jsp w/ <jsp:useBean>,
<-- foo.jsp resp. saving in request scope
POST /contr.jsp --> New request, old request scope
gone
Hans
--
Hans Bergsten [EMAIL PROTECTED]
Gefion Software http://www.gefionsoftware.com
JavaServer Pages http://TheJSPBook.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