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

    How to invoke Java class from post.POST.jsp


      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


      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"));


      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.



      any help will be great