cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Clark" <>
Subject RE: Calling Java classes from (JXForms) javascript - can you? how?
Date Wed, 20 Aug 2003 12:08:44 GMT
I cleaned up everything and ran a series of tests.  This is with 2.1m2.
I shut everything down, made sure my classes were _only_ under:


Started up Jetty/Cocoon and then opened a new browser window.

It worked!  My member function got called from within javascript.  So, not sure what my problem
was yesterday.  The only thing I can think is that I forgot to shutdown Jetty at some point
while trying to get it working and wound up with something bad loaded in the cache/JVM.

Since it's working now, one more question:  When I pass something from javascript to Java,
what's the data format?  e.g. I have a structure in javascript that matches my form (the model).
 I pass this model into my Java class as an Object.  How do I then access the members?  Looking
at the Form class code it appears as if the Object is a DOM tree that I need to access via
xpath expressions using these three classes:
import org.apache.commons.jxpath.JXPathContext;
import org.apache.commons.jxpath.JXPathException;
import org.apache.commons.jxpath.Pointer;

Is this interpretation correct?  Any easier ways to access it (although if it is a DOM, it
does make it nicely generic. :)


> -----Original Message-----
> From:	Geoff Howard []
> Sent:	Tuesday, August 19, 2003 9:10 PM
> To:
> Subject:	Re: Calling Java classes from (JXForms) javascript - can you? how?
> Chris Clark wrote:
> > I figured it out!  Just in case anyone else needs to know...
> > 
> > 1) use Packages.dir.dir.class
> > e.g.
> > 
> > var MyClass = new;
> > 
> > 2) The directories messed me up a bit.  For Java actions, the class files default
to WEB-INF/classes.  In order to get the javascript to run, I had to put the package directory
under my sitemap directory.
> > 
> > e.g. 
> > Sitemap in:
> > c:\cocoon-2.1m2\build\webapp\myweb
> > 
> > Class files in:
> > c:\cocoon-2.1m2\build\webapp\mywebb\com\domain\name
> > 
> > Took a bit to figure it out, but it's working now.  :)
> I was so surprised by this that I forwarded it over to dev and got an 
> unequivocal response that this must be an incorrect conclusion.  Can you 
> start from scratch and clean out your WEB-INF\lib and WEB-INF\classes of 
> all possible references to your class and try again?  Then, assuming 
> that fails (and I'm assured it will) remove it from the webapp dir and 
> put it back in \lib or classes\com\domain\name\MyJavaClass.class and try 
> again.
> If you can confirm that WEB-INF does not work but webapp\...\ does we 
> have a bug.
> Geoff Howard
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message