[opencms-dev] J-Python integration

Paul D. Bain paulbain at pobox.com
Fri Jul 18 01:35:02 CEST 2003


Scott,

         Thanks for posting this email. I have a few questions (see below).

At Thursday 7/17/03 03:34 PM, Scott Newham wrote:
>As part of my investigations I've integrated Python scripting into a JSP 
>so that I can interactively call OpenCMS internals to learn how they work 
>and automate some development tasks.
>
>Jython is an implementation of Python on a JVM.

         Actually, Jython is a compiler. It compiles Python source code to 
Java byte code that can be executed in a Java virtual machine (JVM).

>  The Python code compiles down to Java byte code and allows a virtually 
> seamless mix of Java and Python. You can subclass Java classes in Python 
> and lots more. I find I always use it when doing Java work because it 
> allows rapid investigation without needing a compile/debug cycle.

         I am not certain that I understand this phrase, "allows rapid 
investigation without [requiring] a compile-debug cycle." Could you please 
explain?

>  I'm finding this [ practice (i.e., use of Jython) to be] of greater 
> benefit in OpenCMS because of the latency in editing and publishing JSPs.

         Does your use of Jython save you time? If so, how much? How much 
faster is it to develop in Jython than JSP? Would the answer to that 
question change if OpenCMS could be integrated with a powerful web 
application development framework (WADF) such as Struts, Barracuda, or Web 
Works? I suspect that, if OpenCMS could be integrated with a powerful WADF, 
developement time could be considerably reduced. Recently, on 
JavaLobby.org, there was a discussion of WADF's and the extent to which 
they could be combined.

         I presume that there are WADF's for Jython, too. Do you know of 
any? Do you use one?

>    <snip>
>
>Jython is available from <http://www.jython.org/>http://www.jython.org/
>
>1. Install Jython.
>2. Put a copy of jython.jar in your opencms\WEB-INF\lib directory.
>3. Add -Dpython.home=C:\jython21 to the java startup of opencms. (Using 
>the path where your jython is installed).
>4. Add the following JSP. I call it "py". It's very basic - I just knocked 
>it up to get it working. It could be improved vastly but I really just 
>wanted it to work so I could get on with other stuff.

         Scott, I thank you for outlining how to integrate Jython with 
OpenCMS. I used to be a "server-side Java bigot" until I discovered that 
many smart programmers think that Python is a better designed language than 
Java. Most of my initial OpenCMS programming will probably be done in JSP, 
but I will probably switch to Jython unless third party tools improve 
considerably. One such tool is OpenCMSstruts, which is meant to integrate 
Struts into OpenCMS. See 
http://sourceForge.net/projects/opencmsStruts  .  If you learn of similar 
tools for those who program for OpenCMS using the Jython compiler, please 
post that information to the list.

Sincerely,
Paul Bain




More information about the opencms-dev mailing list