Hmmm,
Thanks for everyone's response(s). By changing the scope to session I get the
same results.
Now, for the interesting part, this is directly from the Sun Tutorial at:
http://java.sun.com/products/jsp/html/jspbasics.fm2.html
---------------------- Forwarded by John G Kroubalkian on 01/03/2000 01:15 PM
---------------------------
From: tedkahn%mindspring.com@Internet on 01/02/2000 11:24 AM
To: John G Kroubalkian@AMEX
cc: JSP-INTEREST%java.sun.com@Internet
Subject: Re: [JSP-INTEREST] JSP Bean in 1st .jsp not seen in 2nd .jsp
Hi John- Try adding scope=session to your useBean spec. The default scope is
page.
-ted
John G Kroubalkian wrote:
> Hello,
> [The code is below]
> I have a bean (SomeBean) and a launch page (launch.jsp)
> The launch page defines a bean: <jsp:useBean id="nameBean" class="SomeBean"
> />
> The launch page includes another .jsp page called problem.jsp.
>
> The problem is that when I reference the bean specified in the first file
> (launch.jsp) from within the 2nd file (problem.jsp) I get the message:
> "nameBean is not defined as bean .... in problem.jsp".
>
> Note: If I add to problem.jsp ==> <jsp:useBean id="nameBean"
class="SomeBean"
> .../>
> I have a problem in that the "nameBean" has already been defined?
>
> Any suggestions?
>
> --------------- The Bean -------------
> publc class SomeBean {
> private firstName;
> public String getFirstName() { return firstName; }
> public void setFirstName(String givenFirstName) {
> firstName = (givenFirstName != null) ? givenFirstName = "";
> }
> }
> --------------- launch.jsp -------------
> <%@ page import="SomeBean" %>
> <jsp:useBean id="nameBean" scope="page" class="SomeBean" />
> <%@ include file="problem.jsp" %>
>
> --------------- problem.jsp -------------
> Hello: <jsp:getProperty name="nameBean" property="firstName" />
>
> ===========================================================================
> 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
===========================================================================
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