I think this is the right direction... you need to declare your variable, 
not just instantiate it.

        <%! NewsBean currentNewsBean; %>  // note the !

This *declaration* will allow this variable to be "in scope" when you break 
out of <%script-mode%> and back into HTML mode with <%=expressions%>


>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<

On 2/12/01, 11:55:35 PM, "Amy Boyett" <[EMAIL PROTECTED]> wrote 
regarding RE: Strange JSP Compilation Problem:


> Hunter, I am a super-newbie, so I'm probably not fully qualified to 
answer
> your question. But I previously had a similar problem, and no one *more*
> qualified has answered your post, so I'll tell you what I had to learn 
the
> hard way. It's a pretty basic concept that is re-iterated throughout the
> spec, but sometimes the most basic concepts elude me until I've done my 
own
> head-banging...

> Declarations, directives, actions and custom tags are executed at
> translation time (when the JSP page is turned into a servlet class).
> Expressions and scriptlets are executed at request time. (There are
> exceptions in JSP 1.2, where an attribute  in an action tag can have a
> request-time value; these exceptions are listed in the 1.2 spec). So,
> anyway, is it possible you are trying to call an object at translation 
time
> that actually doesn't get instantiated until the request? You might also
> want to check the spec regarding page, request, session, and application
> scope. This was helpful to me in understanding when and where objects 
were
> available to me.

> Hopefully, if this is a totally off-base answer, it will encourage 
someone
> more in-the-know to enlighten us both :-)

> Regards,
> Amy
> [EMAIL PROTECTED]

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Hunter
> Hillegas
> Sent: Monday, February 12, 2001 2:00 PM
> To: '[EMAIL PROTECTED]'
> Subject: Strange JSP Compilation Problem


> I have a JSP page that calls some objects that are in a package...

> When I try to view the JSP, it generates a compile error:

> org.apache.jasper.JasperException: Unable to compile class for
> 
JSP/server/jakarta-tomcat-3.2.1/work/localhost_8080%2Fgroundswell/_0002fne
ws
> 
_0002fbackend_0005flabel_0005fnews_0005fedit_00031_0002ejspbackend_0005fla
be
> l_0005fnews_0005fedit1_jsp_0.java:178: Undefined variable or class name:
> currentNewsBean
>                 out.print( currentNewsBean.getRecNum() );

> Okay, this looks very simple... Like I just forgot to instantiate it... 
The
> thing is I didn't... The object gets instantiated prior to being 
called...
> Is there anything else that could be wrong?


> Hunter Hillegas, MCP
> Web Engineer / System Administrator - Jacob Stern & Sons, Inc.
> [EMAIL PROTECTED]
> 805-565-1411 PH * 805-565-8684 FAX


> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]

> _______________________________________________
> tomcat-users mailing list
> [EMAIL PROTECTED]
> https://mailman.real-time.com/mailman/listinfo/tomcat-users


> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to