|
From: Robert W. B. <rb...@di...> - 2000-12-22 21:30:56
|
Hello all,
This was originally on the jython-dev list, but I thought it might be more
appropriate here...
[Ray]
> On Thu, 21 Dec 2000, Ray Leyva wrote:
> > Just wondering. Cause we're building a site based solely on Java, and
> > JSP. I was wondering if it was possible to use Jython from with JSP,
> > and if so can someone send a really really simple ( rudimentary )
> > FooBar, World! style sample.
> >
> > thx
> > rl
[Me]
> I'm been looking at this as well. So far, I'm unable to use a jythonc
> compiled file with Tomcat jsp due to a StackOverflow in __init__ or other
> problems loading the inner class. I think I'm missing something though.
I've come to a point where I need to ask people what it is I'm missing.
The dilemna is the use of jythonc generated classes in JSP pages. For
example, I can have a jython class and .jsp page as follows (roughly from
Frank Chen's original examples):
-------------file: mytest.py---------------------
import java
class mytest(java.lang.Object):
def __init__(self):
self.name = "Jerry"
def myget(self):
"@sig public String myget()"
return self.name
def myset(self, name):
"@sig public void myset(java.lang.String name)"
self.name = name
----------------------------------------------------
This is compiled with "jythonc mytest.py".
------------file: test.jsp-------------------
<%@ page import = "mytest" %>
<html>
<head><title>Jython Test</title></head>
<body bgcolor="white">
<% mytest mt = new mytest(); %>
My name is <%= mt.myget() %>
<% mt.myset("Robert"); %>
<br>No, wait, it's <%= mt.myget() %>
</font></body></html>
-----------------------------------------------
I have never gotten the jythonc compiled file to work, but until today my
JSP work was stuck on a win98 machine. Today, I find out that any of
my jythonc compiled files work fine on my linux and Solaris boxes. It
is as simple as write anything in jython, compile with jythonc and use
the <%@ page import = "filename" %> to use it in JSP, with the above
example being just the tip of the iceburg.
On win98 I still receive a StackOverflow. I have edited the memory
properties of the dos .lnk that I use to start tomcat on Windows, and
have been through all possible permutations of settings as well as
eliminating any backgrounded processes (I think called TSR's on
windows?). I still cannot avoid the StackOverflow when Jasper loads the
requested jythonc compiled file.
All boxes are using Sun jdk1.3, jython-2.0a2, and have 64mb ram.
I was hoping that someone who understands windows (not me) could help
provide some hints on getting it working. Was editing the .lnk memory
properties a likely answer? My memory monitor does not show memory
totally full- can I adjust the stack size java uses? Am I looking
entirely in the wrong direction by focussing on memory allocation? All
classloaders are the same (Jasper/tomcat/sunjdk1.3) so it's not likely
jvm/servlet-container. I do not have any additional windows machines to
test this on to see if it would be a setup problem on one
machine.
My sincere thanks in advance for any suggestions.
-Robert
|