You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by "Sean W. Ferguson" <se...@comcast.net> on 2003/08/27 19:55:15 UTC

[jelly] BSF and Jython Howto

I was wondering if anyone has any examples of mixing jython with jelly code?  I 
can do silly stuff like this:

<jython:script>

   from pawt import swing
   import java

   def exit(e): java.lang.System.exit(0)

   frame = swing.JFrame('Swing Example', visible=1)
   button = swing.JButton('Close Me!', actionPerformed=exit)
   frame.contentPane.add(button)
   frame.pack()

</jython:script>

But I'd like to be able to reference jelly variables in the jython.  If there 
are good examples out there, I'd appreciate the help.  :)

Thanks


Re: [jelly] BSF and Jython Howto

Posted by "Sean W. Ferguson" <se...@comcast.net>.
Nevermind, again I figured it out.  :)

   <core:set var="prefix" value="CUSTOMER"/>

   <jython:script>

     print context.getVariable('prefix')

   </jython:script>

Now, if there's a better way, I'd appreciate knowing it.  :)

Sean W. Ferguson wrote:

> I was wondering if anyone has any examples of mixing jython with jelly 
> code?  I can do silly stuff like this:
> 
> <jython:script>
> 
>   from pawt import swing
>   import java
> 
>   def exit(e): java.lang.System.exit(0)
> 
>   frame = swing.JFrame('Swing Example', visible=1)
>   button = swing.JButton('Close Me!', actionPerformed=exit)
>   frame.contentPane.add(button)
>   frame.pack()
> 
> </jython:script>
> 
> But I'd like to be able to reference jelly variables in the jython.  If 
> there are good examples out there, I'd appreciate the help.  :)
> 
> Thanks
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
>