--- Geoffrey Talvola <[EMAIL PROTECTED]> wrote:
> 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
> 

That's a nice example.

I've taken a different route that might be of interest and I wonder
if the two ideas can be merged?

I've gone the MVC route, where I have servlets that are the
controllers, then one or more psp(s) that are the views for the
servlet.  For instance a servlet:

CustomerInformation.py

has these psp(s) that it can use to display different views

psp/CustomerCreate.psp
psp/CustomerSearch.psp
psp/CustomerChoose.psp
psp/CustomerDisplay.psp

This way I can build small bits of functionality and include them
into other bits of the site.

The part that makes me curious is that I wonder if it makes sense
for the psp views to inherit from the controler servlet.  Does
anyone else have some thoughts on this?


--Karl

__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/

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

Reply via email to