Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to declare a function in a jsp-file

Status
Not open for further replies.

DeSn

Programmer
Nov 20, 2001
111
BE
Hi,

I want to declare a function (no javascript function) in a jsp-file.
Does any know how to do this?
 
You can declare a method like this :

Code:
<%!
    public String sayHello(String hello) {
       return &quot;Hello &quot; +hello;
    }
%>

<% out.println(&quot;This is my method call &quot; +sayHello(&quot;World&quot;));
%>

This in effect creates a private method within the servlet that the JSP is compiled into.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top