Jan 26, 2004 #1 DeSn Programmer Joined Nov 20, 2001 Messages 111 Location BE Hi, I want to declare a function (no javascript function) in a jsp-file. Does any know how to do this?
Hi, I want to declare a function (no javascript function) in a jsp-file. Does any know how to do this?
Jan 26, 2004 #2 sedj Programmer Joined Aug 6, 2002 Messages 5,610 You can declare a method like this : Code: <%! public String sayHello(String hello) { return "Hello " +hello; } %> <% out.println("This is my method call " +sayHello("World")); %> This in effect creates a private method within the servlet that the JSP is compiled into. Upvote 0 Downvote
You can declare a method like this : Code: <%! public String sayHello(String hello) { return "Hello " +hello; } %> <% out.println("This is my method call " +sayHello("World")); %> This in effect creates a private method within the servlet that the JSP is compiled into.