How to access the functions of a servlet

Hello everyone:

I'm developping a JSP page in which I prefer to call a function defined in JSP from inside the code of a class in the form of below:

<%

MyClass foo = new MyClass();

foo.getHTML(); // in the getHTML() OF foo, I call the static function getHTMLBlock defined in JSP.

%>

<%!

public static String getHTMLBlock()

{

...

}

%>

but how to get the access of this static function getHTMLBlock? Thanks

[497 byte] By [lezhanga] at [2007-11-26 15:07:48]
# 1
it seems your method is utility methodwhy don't you declare this method in some utility class and call getHTMLBlock from that class Declaring common method in JSPs is not a good practice....
krish1315a at 2007-7-8 8:57:53 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...