fumitada <[EMAIL PROTECTED]> wrote:
>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.

Both JSPs need the

<jsp:useBean id="catAndSub" class="CatAndSub" scope="application" />

tag so that they can find the object. Marking the scope as application merely 
guarantees that the second JSP will not create a second instance, but will use the one 
already in existence.

------------------------------------------------------------------------
Russell Gold                     | "... society is tradition and order
[EMAIL PROTECTED]                 | and reverence, not a series of cheap
                                 | bargains between selfish interests."
http://httpunit.sourceforge.net  |   - Poul Anderson, "Iron"

___________________________________________________________________________
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

Reply via email to