|
From: Robert W. B. <rb...@di...> - 2001-03-13 15:05:31
|
On Tue, 13 Mar 2001, Eduardo Jesus Fernandez Corrales wrote:
>
> Sure, there it goes.
>
> I am posting the generated file too, in case someone wants to check if it runs.
"*" in import, Hmmmmmm. I tried the following with success...
#spare imports removed and "*" replace with explicit package name
from javax.servlet import http
# prefix superclass with explicit package name "http."
class Hello(http.HttpServlet):
def doGet(req, res):
res.setContentType("text/html")
out = res.getWriter()
out.println("<html><head><title>Hello World!</title></head>")
out.println("<body><h1>Hello World!</h1></body></html>")
Another suspicion is the classpath when you compile. Last I checked, you
can compile something like above _without_ javax.servlet in the
classpath and with no compile errors. However, at runtime you get a NPE,
so you need to make sure javax.servlet.*... is in the classpath rather
than relying on compile time errors to remind you (I don't remember the
original post though, so this may not apply.)
> >>> "brian zimmer" <bz...@zi...> 13/03/01 14:10 >>>
> >It's hard to tell without the servlet file, but make sure the file Hello.py
> >has a single class called 'Hello' that extends from HttpServlet:
I think there can be more than one class. If you have multiple classes
in the file, the servlet class (the subclass of HttpServlet) should be the
same name as the file.
Cheers,
Robert
|