Kevin Murphy wrote:
> >When I'm creating a new page, I'll usually go ahead and 
> create both an
> >"empty" PSP and an "empty" Servlet that is the PSP's base 
> class.  Then I'll
> >start putting the "preparation" methods into the Servlet, 
> and the rendering
> >into the PSP.  You might try working like that.
> 
> I'm new to this, and am intrigued by your idea here...  I 
> wonder, how does this
> work, from a syntactical point of view?  ie. how would one 
> actually go about
> *doing* something like this?  I don't know of (from the very 
> limited documentation
> and experimentation I've done) a way to incorporate PSP into 
> a servlet architecture.
> 

The key is the "page extends" directive in PSP.  Here's a simple example
where the servlet base class has a method that returns a list of "records",
then the PSP renders those records:

########### StupidPageBase.py
from WebKit.Page import Page
class StupidPageBase(Page):
        def records(self):
                return ['foo', 'bar', 'qux']
###########

########### StupidPage.psp
<%@ page extends="StupidPageBase" %>

<ul>
<%for record in self.records():%>
        <li><%=record%>
<%end%>
</ul>
###########

Just stick both files in the same directory, then access StupidPage.psp.


- Geoff

_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to