From: Robert W. B. <rb...@di...> - 2001-03-21 17:56:07
|
Hi Niklas, On Wed, 21 Mar 2001, Niklas Lindstr=F6m wrote: > 1. [see also (3)] > Has anyone successfully used Jython in JSP? I recently discovered the > BSF-taglib from jakarta.apache.org, but that was quite limited in compa= rison > with the ideal of exchanging the native Java for scripting with e.g. Jy= thon. > (I've considered PSP, but it's a little off-standard, and seems > unattended..?) Yes. jythonc compiled files work in JSP just as if they were Java classes. Additionally, Java classes, beans, and taglibs can embed the org.python.util.PythonInterpreter. > 2. [Might be off-topic] > When running two servlets -- compiled from Jython-sources -- in two > different contexts under Tomcat, I run into problems. Tomcat cannot fin= d the > second servlet, unless I put its classes (regular + inner) in the same > context (i.e. in the same (WEB-INF/classes). At first, I thought it was= due > to the "inner class"; but it seems that I have to move both in order fo= r the > servlet to be found. This does not seem to happen to regular Java-servl= ets > though, which is why I wonder if it's a Jython-problem. > My question here is really if someone else has had any problems lik= e > this and has a suggestion at hand; otherwise, I will do some more track= ing > of the problem to see what I might have overlooked. I've only had success with the inner-class and class-proper in the same context. The good stuff in Servlet2.2 containers is the ease of making self-contained webapps, so I'm a bit confused about what the advantages o= f defeating this feature would be. (or I misunderstood :) > 3. [This is definitely off-topic in essence, but in practise, it might = well > touch the roles of Jython (e.g. in JSP)] > > This is a somewhat controversial subject. In Webware's PSP > (webware.sourceforge.net), there is an option to use braces instead of > indentation. This strikes me as a very good solution when embedding > Python-code into "output" (text, HTML, XML etc). Therefore I wonder, si= nce > scripting capabilities in e.g. JSP and XSP (Cocoon) are likely to follo= w > "standard procedures of incorporation" (whatever that is), will Jython = (and > Python) ever have this option? I would not like to see it anywhere else= than > when embedding, but just there it makes sense. Maybe this is more up to= the > implementation of the "server page to code" interpreter though..(such a= s in > Webware's PSP)? Adding braces does make it easier to terminate compound statements/loops when your mixing markup with Python/Jython. I'm skeptical about it really being essential in JSP. Taglibs seem nicer. After all, quality JSP makes heavy use of useBean and taglibs so the amount of inline code i= s minimized anyway. I haven't used webware, but I'm guessing there is not an easy way to add xml tags that determine page logic. Without an equivelant to taglibs, it would be more important to allow other ways to delineate code blocks. Am I mistaken? Does webware allow custom tag definitions? How does Python Server Pages (http://www.ciobriefings.com/psp/) implemen= t this? I only get Zope errors at their site- is this no longer available? Regards, Robert |