<%@ page imports = "sys,os,time"%> <%@ page method="writeContent" %> <%@ page extends="ExamplePage"%>

Hello from PSP!

This is a sample page for an implementation of Python Server Pages (PSP).

The syntax for Python Server Pages is almost identical to that of Java Server Pages (JSP). Just the scripting language is different! And obviously better. In fact, just about anything you can do with JSP, you can do with PSP, and more. The only thing the current implementation is missing is Beans, and we'll top that shortly. In the meantime, with PSP, not only can you create template text that will be inerted in one method when the page is run as a servlet, but you can choose which base class to inherit from, you can choose which method of the base class to over-ride with your template text, and you can add additional methods to the servlet class, all from the PSP template code.

I know, Cool, huh?

The text below comes from another jsp page which was inserted into this one with the <%@ incude %> directive.

<%@ include file="../../PSP/Examples/my_include.psp" %>

There are two ways to insert the contents of another file into a PSP page:

<%-- This actually works? --%>

Below is a loop test

Operating system information

This works only under Unix:

<% if hasattr(os, 'uname'): info = os.uname() else: info = (sys.platform, '(node)', '(release)', '(version)', '(machine)') for i in info: res.write('') res.write('') %>
' + str(i) + '
' + req.pathInfo() + '

The time is:

<%= time.ctime(time.time())%> <%-- Comment check --%>

Method call:

self._response.write('

You passed a %s

' % val)
<%self.testing('value')%> <% pass %>