<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2600.0" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2><FONT face=Arial size=2>Paul</FONT></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2><FONT face=Arial 
size=2>>Scott,<BR>><BR>>         
Thanks for posting this email. I have a few questions (see 
below).<BR>><BR>>At Thursday 7/17/03 03:34 PM, Scott Newham 
wrote:<BR>>>As part of my investigations I've integrated Python scripting 
into a JSP <BR>>>so that I can interactively call OpenCMS internals to 
learn how they work <BR>>>and automate some development 
tasks.<BR>>><BR>>>Jython is an implementation of Python on a 
JVM.<BR>><BR>>         Actually, 
Jython is a compiler. It compiles Python source code to <BR>>Java byte code 
that can be executed in a Java virtual machine (JVM).<BR></DIV></FONT></FONT>
<DIV><FONT face=Arial size=2><FONT face=Arial size=2>It's more than a 
compiler because there's runtime support (written in Java) to support 
Python semantics and to bridge the gaps between the languages. But this is 
really getting off the point...</FONT></FONT></DIV><FONT face=Arial size=2><FONT 
face=Arial size=2>
<DIV><BR>>>  The Python code compiles down to Java byte code and 
allows a virtually <BR>>> seamless mix of Java and Python. You can 
subclass Java classes in Python <BR>>> and lots more. I find I always use 
it when doing Java work because it <BR>>> allows rapid investigation 
without needing a compile/debug 
cycle.<BR>><BR>>         I am not 
certain that I understand this phrase, "allows rapid <BR>>investigation 
without [requiring] a compile-debug cycle." Could you please 
<BR>>explain?<BR></DIV>
<DIV>I use Jython at the command shell to create some java 
objects and call their methods with various arguments - the sort of thing 
you might write a test app to find out how things work. </DIV>
<DIV>This would normally require opening an editor, writing a class, compiling 
and running but because you can run Jython interactively (and because it has 
other short cuts) I find it more productive.</DIV>
<DIV><BR>>>  I'm finding this [ practice (i.e., use of Jython) to be] 
of greater <BR>>> benefit in OpenCMS because of the latency in editing and 
publishing JSPs.<BR>><BR>>         
Does your use of Jython save you time? If so, how much? How much <BR>>faster 
is it to develop in Jython than JSP? Would the answer to that <BR>>question 
change if OpenCMS could be integrated with a powerful web <BR>>application 
development framework (WADF) such as Struts, Barracuda, or Web <BR>>Works? I 
suspect that, if OpenCMS could be integrated with a powerful WADF, 
<BR>>developement time could be considerably reduced. Recently, on 
<BR>>JavaLobby.org, there was a discussion of WADF's and the extent to which 
<BR>>they could be combined.</DIV>
<DIV> </DIV>
<DIV>I'm not using it as a replacement to JSP but that's possible though it 
would be slower. My point was related to the earlier one about using Jython to 
investigate methods. I find this helpful in OpenCMS and other systems that don't 
have much documentation about the interfaces. For example  I wanted to find 
out how a "web user" differed to a regular user and in fact whether this 
stuff still worked at all. So I quickly scripted up some calls to create a user 
and ran it from my python JSP within OpenCMS. What makes it quick is not having 
to edit a JSP within OpenCMS which is a slow process compared to changing a line 
of python and resubmitting my web form in seconds.</DIV>
<DIV> </DIV>
<DIV>I could imagine using some scripts to populate an environment with users 
and resources for testing purposes. The scripts execute within a running 
opencms.</DIV>
<DIV> </DIV>
<DIV>I hadn't seriously thought about the issues you raise about Struts 
etc.</DIV>
<DIV><BR>>         I presume that 
there are WADF's for Jython, too. Do you know of <BR>>any? Do you use 
one?</DIV>
<DIV> </DIV>
<DIV>No, sorry but you've got me thinking about it.</DIV>
<DIV><BR>>>    <snip><BR>>><BR>>>Jython 
is available from <<A 
href="http://www.jython.org/>http://www.jython.org/">http://www.jython.org/>http://www.jython.org/</A><BR>>><BR>>>1. 
Install Jython.<BR>>>2. Put a copy of jython.jar in your 
opencms\WEB-INF\lib directory.<BR>>>3. Add -Dpython.home=C:\jython21 to 
the java startup of opencms. (Using <BR>>>the path where your jython is 
installed).<BR>>>4. Add the following JSP. I call it "py". It's very basic 
- I just knocked <BR>>>it up to get it working. It could be improved 
vastly but I really just <BR>>>wanted it to work so I could get on with 
other stuff.<BR>><BR>>         
Scott, I thank you for outlining how to integrate Jython with <BR>>OpenCMS. I 
used to be a "server-side Java bigot" until I discovered that <BR>>many smart 
programmers think that Python is a better designed language than <BR>>Java. 
Most of my initial OpenCMS programming will probably be done in JSP, <BR>>but 
I will probably switch to Jython unless third party tools improve 
<BR>>considerably. One such tool is OpenCMSstruts, which is meant to 
integrate <BR>>Struts into OpenCMS. See 
<BR>>http://sourceForge.net/projects/opencmsStruts  .  If you learn 
of similar <BR>>tools for those who program for OpenCMS using the Jython 
compiler, please <BR>>post that information to the 
list.<BR>><BR>>Sincerely,<BR>>Paul Bain<BR></DIV>
<DIV>I don't look at it as Java versus Python as each has its benefits and 
suitability to different things. Note that Python (the original C based one) has 
been used to write some decent sized systems such as Zope. I use them for 
different things and in this case Jython complements Java. It's also handy for 
adding scripting to Java apps.</DIV>
<DIV> </DIV>
<DIV>Thanks for your questions and comments. I hope it's of use to some 
people.</DIV>
<DIV> </DIV>
<DIV>Scott</DIV>
<DIV> </DIV></FONT></FONT></BODY></HTML>