Skip navigation
chamila.fernando
Currently Being Moderated

How to invoke Java class from post.POST.jsp

Sep 25, 2012 5:51 AM

Tags: #java #class #to #from #how #method #the #is #undefined #invoke #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

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

 
Replies
  • Currently Being Moderated
    Sep 25, 2012 1:15 PM   in reply to chamila.fernando

    1.  In the interface [1] not the implementation[2] have u defined the method test?

    2.  If it is implemented, Change the bundle version in bnd file and make a new build. Then from felix console verify the latest version reflected in the bundles.

    If 2 works & you are going to make lot of frequent changes then give the version as snapshot till it get stable.

     

    [1]  com.day.test.datasource.DatasourceUtil

     

    [2]   com.day.test.datasource.DatasourceUtilImpl

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points