Didn't I see HTML embedded Python? (Not Zope?)

Brian Zhou brian_zhouNOSPAM at techie.com
Tue Apr 3 16:44:44 EDT 2001


In addition to Cameron's list, there's also Jython Servlet, if you can
afford a VM and are comfortable with java servlet, servlets are actually
easier to write than in java, embedding HTML is easier and more readable
too.

Here is the "hello world" example:

        import java, javax, sys

        class hello(javax.servlet.http.HttpServlet):
            def doGet(self, request, response):
                response.setContentType("text/html");
                out = response.getOutputStream()
                print >>out, """\
        <html>
        <head><title>Hello World</title></head>
        <body>Hello World from Jython Servlet at server time %s!
        </body>
        </html>
        """ % (java.util.Date(),)
                out.close()
                return

Here is a a wiki about it:
http://jywiki.sourceforge.net/index.php?JythonServlet

IMHO embedding HTML in code or code in HTML only works for small site, for
larger system, you need clear separation of presentation and logic.

/Brian

"Russell Turpin" <rturpin at do.not.use> wrote in message
news:3ACA168A.13850B09 at do.not.use...
> I seem to remember seeing something recently about support
> for HTML embedded Python. Not Zope, but something simpler.
> But I could be confused -- that corner of my cranium seems
> to have cobwebs. Can anyone give me a pointer?
>
> Thanks!
>
> Russell





More information about the Python-list mailing list