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

Reply via email to