Think about what declarations do - the declare methods or variables that
have class scope. This means the parser for this page will create a class
and add a method call 'public void f()' to that class - 'out' is not a class
scope variable, it is a local variable defined in _jspService of type
JspWriter. You could make the code compile by chaning it to
<%! public void f(int i, JspWriter out) { if (i<3) out.println("..."); } %>
and passing the JspWriter it 'f' whenever you need it,
Kevin
-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Chad Darby
Sent: 28 June 1999 13:47
To: [EMAIL PROTECTED]
Subject: Error in JSP Spec? Declarations: Sec 2.10.1, page 52
Hi All,
I think there is an error in the example for Declarations. Someone may
have already pointed this out. If not, then here goes...
Declarations: Sec 2.10.1, page 52
----------------------------------
The second example of a declaration reads:
<%! public void f(int i) { if (i<3) out.println("..."); } %>
According to the spec, "Declarations" do not have access to the "out"
object. However, this example tries to state otherwise. I tried the
example above on JWS 2.0 b2 and it didn't compile. If I understand the
definition of a "declaration", JSP code in a declaration block simply
performs an operation/assignment without sending anything to the
output. That should be left up to the caller.
Please correct me if I'm wrong. Cheers!
--
-----------------------------------------------
Chad (shod) Darby | J9 Consulting, Inc.
[EMAIL PROTECTED] | http://www.j-nine.com
-----------------------------------------------
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JSP-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JSP-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".