Thanks for the tip on using j:new. I really wish there was some good documentation on Jelly.

One thing I think I should point out that may or may not be a bug is that if I put the code inside the declaration of the textfield, it doesn't catch events.

<textField var="customerId" text="" columns="10">
  <core:new var="keyAdapter" className="JellyKeyAdapter"/>
  ${customerId.addKeyListener(keyAdapter)}
</textField>

But if I move the code block outside of the declaration, it works fine.
<textField var="customerId" text="" columns="10"/>
<core:new var="keyAdapter" className="JellyKeyAdapter"/>
${customerId.addKeyListener(keyAdapter)}

I know I don't understand fully how Jelly works, but I would have thought it would work both ways.

Again, thanks for you help!

Eric Galluzzo wrote:

Sean Ferguson wrote:

Hahahah, I didn't realize the embedded java code was jexl. :)

I tried just adding my key listener and it didn't work.

Here is the code
 <textField var="customerId" action="${load}" text="" columns="10">
   ${addKeyListener(new JellyKeyAdapter())}
 </textField>

Where JellyKeyAdapter() is a class I have in the same directory as my jelly file. Jexl complains of a parse error.


Jexl doesn't support new, and all method calls must be prefixed with the object on which they are called. However, you can do something like this:

<textField var="customerId" action="${load}" text="" columns="10">
 <j:new var="keyAdapter" className="com.foo.bar.JellyKeyAdapter"/>
 ${customerId.addKeyListener(keyAdapter)}
</textField>

- Eric



---------------------------------------------------------------------
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]



Reply via email to