JSP compiles to servlets.
Servlets are Java.
What happens in Java if you try and use a variable before declaring it?
In a servlet try
CatAndSub catAndSub = getServletContext().getAttribute("catAndSub");
carAndSub.getXXX();
in a JSP
<jsp:useBean id="catAndSub" type="CatAndSub" scope="application" />
<% catAndSub.getXXX(); %>
Kevin Jones
DevelopMentor
www.develop.com
> -----Original Message-----
> From: A mailing list for discussion about Sun Microsystem's Java Servlet
> API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of
> fumitada
> Sent: 30 January 2001 07:08
> To: [EMAIL PROTECTED]
> Subject: I don't understand scope in jsp.
>
>
> Hi there.
>
> Can I ask about jsp here ??
>
> If not, please ignore...
>
> I instantiate a bean like this <jsp:useBean id="catAndSub"
> class="CatAndSub" scope="application" /> in a jsp.
> Can I call this instance(catAndSub) from the other jsp or servlets ?
>
> I trid to use this instance in the other jsp, like
> <% catAndSub.getXXX(); %>
> but I got the following error :
>
> javax.servlet.ServletException: Compilation error occured:
> Found 1 errors in JSP file:
> /home/fumitada/public_html/htdocs/jp/test_scope.jsp:2: Error:
> "catAndSub" is either a misplaced package name or a non-existent entity.
>
> I thought even though I don't instantiate the bean in the jsp where I
> got error, I already instantiated the bean with application scope in the
> first jsp so that I can use the instance from the other jsp or servlet.
>
> I don't understand what's happening here...
> then what's the point I instantiate the bean with application scope in
> the first jsp...
>
> ps) of course, I accessed both jsp with the same user session.
>
> Fumitada Hattori.
>
> __________________________________________________________________
> _________
> To unsubscribe, send email to [EMAIL PROTECTED] and include
> in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html