Thanx a lot, works perfectly, what I had missed was "!"
but any idea what is the difference between declaring a function in jsp
"private or public"
Also I tried this import statement but the browser (IE) gives a huge error
statement
with the first line saying
"org.apache.jasper.compiler.ParseException: C:\jsp\yourfile.jsp(0,4) Invalid
directive"
any idea will be most welcome
thanx
peter

-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of Joe
Shevland
Sent: 24 April, 2001 9:48 AM
To: [EMAIL PROTECTED]
Subject: Re: writing a function in JSP


Yup:

<%!
    private String myLocalVariable = "";

    private void myFunction() {
        //...
    }
%>

Note that you'll often need to pass in the HttpRequest and HttpResponse
objects to use these.

Cheers,
Joe

> -----Original Message-----
> From: Peter Barraud [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, 24 April 2001 2:05 PM
> To: [EMAIL PROTECTED]
> Subject: writing a function in JSP
>
>
> Is it possible to write a java/servlets function is a jsp page
> for example: can I write a function something like this:
> <%
> public String getName()
>         {
>         return "YourName";
>         }
> %>
> Thanx
> Peter
> -----Original Message-----
> From: A mailing list for discussion about Sun Microsystem's
> Java Servlet
> API Technology. [mailto:[EMAIL PROTECTED]]On
> Behalf Of Mark
> Galbreath
> Sent: 24 April, 2001 8:04 AM
> To: [EMAIL PROTECTED]
> Subject: Hey, Jason!
>
>
> Two questions:
>
> 1.  Reading both editions, I can't really tell who (Will or
> you) wrote what.
> Any hints on that?  Not that's it's important, just cool to know.
>
> 2.  On page 59 of the 2d Edition (footnote): would you
> publish the code here
> that you wrote to do that?
>
> Cheers!
> Mark
>
> ______________________________________________________________
> _____________
> 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
>

___________________________________________________________________________
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

Reply via email to