Hello Stephane,
it is very simple! You only have to write:
... importClass(Packages.com.xyz.MyClass); ...
In your code the string "Packages." is missing!
see also at http://cocoon.apache.org/2.1/userdocs/flow/java.html
I hope that helps!
Dirk
Stephane Delort wrote:
Hi,
I made a simple flowscript which would call a home made java class.
Here is the flowsctipt :
cocoon.load("resource://org/apache/cocoon/forms/flow/javascript/Form.js");
function main() { importClass(com.myCompany.myProject.User); importPackage(java.util);
var form = new Form("forms/login.xml"); form.showForm("login-display-pipeline"); var model = form.getModel();
var newUser = new com.edag.lastenheft.db.User(); var list = new ArrayList(); //var insert = newUser.coucou(); //model.name, model.password); cocoon.sendPage("confirm.jx"); }
the .class is in the [$cocoon]/build/webapp/WEB-INF/classes/com/mCompany/myProject
Here is the JAVA code :
import java.lang.*; import java.util.*; import java.sql.*;
public class Userpublic class User { public int toto = 5;
User() {,}
public int addUser(String name, String surname ) { // should not be empty once the flowscript works }
}
THe strange thing is that it is ok for the java.util package and the ArrayList class but the program STOPs (I mean it display a http://anypath/[numbers]*.continue instead of the JXtemplate page). I also tried importClass(Packages.com.myCompany.myProject.User) and importPackage(Packages.com.myCompany.myProject) unsuccessfully.
Any help will be greatly apreciated as I don't find anything on the Mozilla-Rhino API.
Thanks in advance, Stephane
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
