Take it one step at a time and try to figure out what's happening.
How about this:
function loginf() {
var newUser = new Packages.mypackage.User();
newUser.setName("myName");
newUser.setPasswrd("myPassword");
print("I have an object of class User? " + newUser);
print("newUser should have name and passwd set: " + newUser.getName() + ",
" + newUser.getPasswrd());
}
the content of print should show up in your console (Jetty, Tomcat or
whatever you're using).
Bye, Helma
> -----Original Message-----
> From: Stephane Delort [mailto:[EMAIL PROTECTED]
> Sent: Friday, 18 June 2004 15:57
> To: [EMAIL PROTECTED]
> Subject: [flowscript] importclass ?
>
>
> >Note that you haven't added the user to the page (the viewdata
> construction)
> >in your script, so there is nothing to be displayed from the newUser
> object.
>
> Ok, but aren't we able to create objects whitout displaying
> them ? (in my case a java class which will insert data in a database )
>
> >I suppose main() works, although I would avoid using 'main'
> as name to
> >avoid conflicts with assumptions elsewhere.
>
> Yep, it was just a snippet, but I also changed it.
>
> and by the way, it still does not work :(
>
> I did not find a sample doing this kind of thing : calling an
> custom java class from the flowscript with importClass ou
> importPackage. If anyone saw one ......
>
> Stephane
>
>
>
> here is a copy of my latest try thanks to Helma :
>
>
> cocoon.load("resource://org/apache/cocoon/forms/flow/javascrip
> t/Form.js");
> function loginf()
> {
> var form = new Form("forms/login.xml");
> form.showForm("login-display-pipeline");
> var model = form.getModel();
>
> var insert = newUser.setName(model.name, model.password); // (a)
> var viewData = {user: newUser};
> cocoon.sendPage("confirm.jx",viewData); // this page is
> never displayed if (a) and (b) exists }
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]