From: Marlon A. G. <kal...@ro...> - 2002-10-16 18:52:48
|
Hi all, This is my first posting and thus be patient. I am also new to Java programming and heard about Jython and am thoroughly enjoying its ease of use and syntax when it comes to Java. I have been using Jython for Java Programmers as my learning aid. Here is the example I am working with: # file: NameHandler.py import java class NameHandler(java.lang.Object): def __init__(self): self.name = "Fred" def getUsername(self): "@sig public String getname()" return self.name def setUsername(self, name): "@sig public void setname(java.lang.String name)" self.name = name Which is compiled using: jythonc -w . Namehandler.py The jsp code is: <!--file: name.jsp --> <%@ page contentType="text/html" %> <jsp:useBean id="name" class="NameHandler" scope="session"/> <html> <head> <title>hello</title> </head> <body bgcolor="white"> Hello, my name is <jsp:getProperty name="name" property="username"/> <br> No, wait... <jsp:setProperty name="name" property="username" value="Robert"/> , It's really <%= name.getUsername() %>. </body> </html> The jythonbean compiles with jythonc giving a deprecation error. I move the two classes as described in the tutorial, the /WEB-INF/classes directory. But when I run the jsp in Tomcat, I get the java error, NoClassDefFound, which means the jvm can't find the java class definition for my compiled jythonbean. Help! Does anyone know what is incorrect about the above syntax? Any other suggestions, i.e. what should my classpath be, etc? My System: - Mac OSX 10.1.5 running freeBSD - java 1.3.1 - jython 2.1 installed using the package at http://www.jython.org - jython.jar is in the /WEB-INF/lib folder. P.S. The full tutorial is also online at: http://www.newriders.com/articles/article.asp?product_id={5D896109-071B-4FC2-979B-CB72B7E89A38}&element_id={5EA1CE87-813B-4C00-AABA-03F7394CBC2F}&st=AD584C10-1946-4212-AA7C-611EE54D787B&session_id={A6350DA2-476D-4CDB-AE8A-84BFDCCE2F60}. -- Make it a great day! Kal...@ro... "Don't let your schooling interfere with your education." Mark Twain "Do not parrot the words of famous people. Learn the meaning of what they say and repeat it in your own words." Mark Twain (not an exact quote). "Intel spends an average of $8,000 a year per for each PC to keep its internal PC network running, and that figure is probably close to what other corporations spend, Intel spokesman Tom Waldrop said." The Oregonian, 9/25/96, Anthony Effinger |