Originally posted by Praful Thakare:
Hari,
I dont have knowledg of ASP,but this is how u can define and call function in jsp
[B]<%![B]
public void myfunction()
{
}
%>
<%
myfunction();
%>
Hope this helps you
Cheers
Praful
hi ,This is how i tried it . I had only this code in my jsp file .
<%!
public void myfunction()
{
%>
<%="inside function "%>
<%
}
%>
<%
myfunction();
%>
but it gives the following error:
Error: 500
Internal
Servlet Error:
org.apache.jasper.JasperException: Unable to compile class for JSPC:\jakarta-tomcat-3.2.4\work\localhost_8080%2Fppfp\_0002fjsp_0002fWebSite_0002ftest_0002fTestFunction_0002ejspTestFunction_jsp_0.java:22: '}' expected.
{
^
C:\jakarta-tomcat-3.2.4\work\localhost_8080%2Fppfp\_0002fjsp_0002fWebSite_0002ftest_0002fTestFunction_0002ejspTestFunction_jsp_0.java:25: Statement expected.
static {
^
C:\jakarta-tomcat-3.2.4\work\localhost_8080%2Fppfp\_0002fjsp_0002fWebSite_0002ftest_0002fTestFunction_0002ejspTestFunction_jsp_0.java:76: 'try' without 'catch' or 'finally'.
out.write("\r\n");
^
C:\jakarta-tomcat-3.2.4\work\localhost_8080%2Fppfp\_0002fjsp_0002fWebSite_0002ftest_0002fTestFunction_0002ejspTestFunction_jsp_0.java:83: Type expected.
} catch (Exception ex) {
^
4 errors