I was courious on how to integrate Groovy in Wicket via Spring. I want
to trigger a script via onSubmit action. The groovy script should print
some lines on the console. But the code is never executed (at least it
seems so).
We are using the mvn jetty plugin, there are no problems, neither during
startup, nor in running mode. The script lies in target/Lime.groovy, so
there is no Lime.class.
Roman
If anybody else is interested in that problem, here's the code:
ILime.java:
public interface ILime {
public void roll();
}
...
Lime.groovy:
class Lime implements ILime {
void roll() {
println "Some nice text here"
}
}
...
applicationContext.xml:
...
<lang:groovy id="lime"
script-source="classpath:org/liland/webapps/myproject/scripts/Lime.groovy"/>
<bean id="importTool"
class="org.liland.webapps.myproject.pages.contact.ImportTool">
<property name="lime" ref="lime"/>
</bean>
...
ImportDetailPage.java:
...
private class ImportDetailsForm extends Form {
//calls the script
private ImportTool importTool;
protected void onSubmit() {
try {
importTool.doSth();
}...
}
}
...
A helper class that gets the script injected
ImportTool.java:
private ILime lime; //inject this via Spring
public void doSth() {
out.println("doSth"); //shows up at the console
lime.roll(); //execute groovy script, but does NOT show up at
the console?
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]