1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/examples/JavaServlet/JSPTest/Common/JSPTest/__init__.py Fri Oct 05 22:30:25 2007 +0000
1.3 @@ -0,0 +1,22 @@
1.4 +#!/usr/bin/env python
1.5 +
1.6 +"A simple application for test purposes."
1.7 +
1.8 +import WebStack.Generic
1.9 +
1.10 +class JSPTestResource:
1.11 +
1.12 + "A simple resource."
1.13 +
1.14 + def respond(self, trans):
1.15 +
1.16 + # Store some information in attributes.
1.17 +
1.18 + print "Attributes..."
1.19 + attr = trans.get_attributes()
1.20 + attr["hello"] = "world"
1.21 + rd = trans.get_servlet().getServletConfig().getServletContext().getRequestDispatcher("/test.jsp")
1.22 + print "Forward..."
1.23 + rd.forward(trans.request, trans.response)
1.24 +
1.25 +# vim: tabstop=4 expandtab shiftwidth=4
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/examples/JavaServlet/JSPTest/JSPTestApp.py Fri Oct 05 22:30:25 2007 +0000
2.3 @@ -0,0 +1,9 @@
2.4 +#!/usr/bin/env python
2.5 +
2.6 +from WebStack.Adapters.JavaServlet import deploy
2.7 +from JSPTest import JSPTestResource
2.8 +
2.9 +JSPTestApp = deploy(JSPTestResource(), handle_errors=0)
2.10 +print "Deployed."
2.11 +
2.12 +# vim: tabstop=4 expandtab shiftwidth=4
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/examples/JavaServlet/JSPTest/test.jsp Fri Oct 05 22:30:25 2007 +0000
3.3 @@ -0,0 +1,9 @@
3.4 +<html>
3.5 + <head>
3.6 + <title>Test of JSP</title>
3.7 + </head>
3.8 + <body>
3.9 + <p>Hello <%= request.getAttribute("hello") %>! (attribute "hello")</p>
3.10 + <p>Goodbye <%= request.getParameter("hello") %>! (parameter "hello")</p>
3.11 + </body>
3.12 +</html>