17 Mar 2011, 18:32
Generic-user-small

Sidath Periyasamy (1 post)

down vote favorite

Hi

I am very new to groovy and having trouble with some parts.

I have a jsp page tied to a servlet that runs groovy scripts. I am able to get to the groovy script from the servlet. But after the script runs how do I return the response from the groovy script back to the servlet to be displayed in the jsp page?

My java servlet code is as follows:

File file = new File(“TestScript.groovy”);
ClassLoader parent = getClass().getClassLoader(); GroovyClassLoader loader = new GroovyClassLoader(parent); Class groovyClass = loader.parseClass(file); Object[] args = {}; GroovyObject groovyObject = (GroovyObject) groovyClass.newInstance(); Object ret = groovyObject.invokeMethod(“runTest”, args);

In my TestScript.groovy i have the following: class TestScript {

@Test
public String runTest()
{
       //run test

       return response

}

}

I get the following exception: groovy.lang.MissingPropertyException: No such property: output for class:

  You must be logged in to comment