From: Robert W. B. <rb...@di...> - 2001-03-13 16:32:07
|
On Tue, 13 Mar 2001, brian zimmer wrote: > Robert, > > This works for you? Don't you need to add 'self' to the doGet() > method? It's an instance method, no? YES! Thank you. Typing changes in reply instead of copy/paste from the servlet was just error prone. Sooo sorry about that. Brian is right, it must have self as first parameter to method. Robert > At 09:07 AM 3/13/2001 -0600, Robert W. Bill wrote: > > > >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 > > > > > > > > > >_______________________________________________ > >Jython-users mailing list > >Jyt...@li... > >http://lists.sourceforge.net/lists/listinfo/jython-users > |