2 Replies Latest reply: Sep 26, 2012 5:06 AM by chamila.fernando RSS

    How to invoke Java class from post.POST.jsp

    chamila.fernando

      Hi All,

       

      I am trying to invoke a simple java method from post.POST.jsp

       

      I am getting below exception while doing it.

       

      org.apache.sling.api.scripting.ScriptEvaluationException: org.apache.sling.scripting.jsp.jasper.JasperException: Unable to compile class for JSP:

       

      An error occurred at line: 32 in the jsp file: /apps/mywebsite/components/customFormAction/post.POST.jsp

      The method test() is undefined for the type DatasourceUtil

      29:          

      30:           ///

      31:          com.day.test.datasource.DatasourceUtil dsUtil = new com.day.test.datasource.DatasourceUtilImpl();

      32:          dsUtil.test();

      33:           //dsUtil.validateLogin(request.getParameter("username"), request.getParameter("password"));

      34:          

      35:           ////

       

      It appears to resolve the class correctly. I could run the code, if I only comment  dsUtil.test();. As soon as I uncomment, it gives above error.

       

      In the Utill I have a simple void method which will print a simple text. My package structure is as follows.

       

      pkg.png

      any help will be great

       

      Tx