commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sean Ferguson <seansli...@comcast.net>
Subject Re: [JELLY] Key listeners
Date Tue, 22 Jul 2003 17:02:50 GMT
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: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 


Mime
View raw message