Differences between revisions 7 and 8
Revision 7 as of 2007-09-30 11:47:05
Size: 1278
Editor: TonyLocke
Comment:
Revision 8 as of 2007-09-30 12:11:49
Size: 1628
Editor: TonyLocke
Comment: Added servlet context example to PyServlet
Deletions are marked like this. Additions are marked like this.
Line 20: Line 20:
See [http://seanmcgrath.blogspot.com/JythonWebAppTutorialPart1.html Sean McGrath's PyServlet Turorial] for an introduction. The simplest possible Jython servlet is: See [http://seanmcgrath.blogspot.com/JythonWebAppTutorialPart1.html Sean McGrath's PyServlet Turorial] for an introduction. Below are a couple of examples:
Line 22: Line 22:
{{{#!python Simple: {{{#!python
Line 30: Line 30:

Using servlet context: {{{#!python
from javax.servlet.http import HttpServlet

class Simple(HttpServlet):
    def doGet(self, request, response):
        response.setContentType("text/plain")
        response.getWriter().println(self.getServletContext().getServerInfo() +
                                     " Veni, vidi, vici!")
}}}

Other Examples in Jython

DocumentationAndEducation

TableOfContents


Log4j

  • This is a simple Log4jExample that show how to use this excellent logger with Jython. Yes, Python provides a logger but log4j can be used for debugging apache stuff. What ever you use loggers use its better then using print statements. You can get log4j from http://logging.apache.org/log4j/1.2/download.html

Apache Poi

  • No this isn't really bad Hawaiian food but a really slick way to write out Excel xls and other Microsoft Office format files with out have to have any microsoft software installed. Poi is really slick Java API and pretty easy to use. Take a look at the PoiExample and to download it and get more information on Poi and visit http://poi.apache.org/

PyServlet

See [http://seanmcgrath.blogspot.com/JythonWebAppTutorialPart1.html Sean McGrath's PyServlet Turorial] for an introduction. Below are a couple of examples:

Simple:

   1 from javax.servlet.http import HttpServlet
   2 
   3 class Simple(HttpServlet):
   4     def doGet(self, request, response):
   5         response.setContentType("text/plain")
   6         response.getWriter().println("Veni, vidi, vici!")

Using servlet context:

   1 from javax.servlet.http import HttpServlet
   2 
   3 class Simple(HttpServlet):     
   4     def doGet(self, request, response):
   5         response.setContentType("text/plain")
   6         response.getWriter().println(self.getServletContext().getServerInfo() +
   7                                      " Veni, vidi, vici!")

OtherExamples (last edited 2011-04-04 18:53:37 by c73-102)