From: <nik...@va...> - 2001-03-21 19:23:38
|
Hi again. :) From: Robert W. Bill [mailto:rb...@di...] Sent: Wednesday, March 21, 2001 11:52 PM >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 comparison >> with the ideal of exchanging the native Java for scripting with e.g. Jython. >> (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. > That sounds great. How about performance in these cases; like for a = Bean written in Jython? Is there anything "official" out there that makes use of Jython in = JSP, other than that BSF-thing (which didn't seem to have a global scope..:/ = )? ----8<---- *snip* ---->8---- >> 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, since >> scripting capabilities in e.g. JSP and XSP (Cocoon) are likely to = follow >> "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 as 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 is >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? I fully agree with you (actually, I'm a firm believer in logic/content/presentation-models; in a web-context preferably using = XSLT). But using taglibs for looping and tests seems somewhat superfluous (may = be a good idea though - I've done a thing like that for XML; inspired by = XSP:s taglibs). The situations are still there though, where embedding raw logic in presentation is the quickest (albeit dirtiest) way to build stuff. In = such cases, the indent-retraints may impose on both readability and firmness = when using Python. As for Webware, I'm not sure. I do know that they are to some extent inspired by the Jakarta-project; and that they provide a similar functionality as servlets and JSP. But I doubt the use of XML is as extensive. There seem to be quite some JSP-similarity though (more than = to ASP/PHP). >How does Python Server Pages (http://www.ciobriefings.com/psp/) = implement >this? I only get Zope errors at their site- is this no longer = available? I have the feeling that this is a somewhat inactive project. They use = an "end block" statement. I do not know if this is all, or if indent is = also used. Generally, I've seen the use of a special "end", or forcing = dedent using "pass". These solutions all seem shaky in embedded stuff though = (an explicit "no block scope with indent - use braces" would be more safe = here). Remark: is this discussion considered out of this list's context? Finally, I'll just mention that I've had great success in using Jython togeheter with Xalan's extension mechanism for XSLT. Just to spread the word. ;) regards Niklas |