--> Thursday, August 28, 2003, 1:55:12 PM, [EMAIL PROTECTED] wrote:

> Can I include a PSP file from my Servlet? I am guessing this seems a bit
> backwards, but not to me.

Ok, I want to use PSP as a template language I can include in my Servlet.

I have the following in a Servlet subclassed by a bunch of PSP pages.

###########################################################################

  def writeContent(self):
    self.writeLayout()
  
  def writeLayout(self):
  #------------------------------------------------------------------------
    self.write(
      '''
      <table border=1 width=100%%>
        <tr>
          <td>%s:</td>
          <td>
            <div align=center>
              some links
            </div>
          </td>
        </tr>
        <tr>
          <td>          
            this will be the branch menu
          </td>          
          <td>
            some more links
          </td>
        </tr>
        <tr>
          <td>stuff</td>
          <td>stuff</td>
        </tr>
      </table>
      <table border=1 width=100%%>
        <tr>
          <td>
      '''
      % (self.thing)
    ) 
  #------------------------------------------------------------------------
    self.writeMyPage(self)
  #------------------------------------------------------------------------
    self.write(
      '''
          </td>
        </tr>
      </table>
      '''
    )    
  #------------------------------------------------------------------------
  
  def writeMyPage(self):
    self.write('<p> This MyPage has not yet been written </p>')

###########################################################################
# ( PSP pages are overriding writeMyPage )

Now, I hate the writeLayout method as I've implemented it here. I would love
for writeLayout to look *something* _like_ this instead...

  def writeLayout(self):
    self.include('./MyPageHeader.psp')
    self.writeMyPage(self)
    self.include('./MyPageFooter.psp')
    # even if this means I am using a psp superset, .pst or something.
    # ( .pst for Python Server Template... *shrug* )

Or likely something more evolved than that, probably not separating header
and footer. Anyway, you should be able to see what I want to do; use PSP as
a templating language. Can I do this? I imagine it might be tricky since PSP
are compiled to servlets and this itself is a servlet.

What other options exist for making writeLayout more manageable?

I don't like any of the templating languages like Cheetah, etc, because many
of those are too similar to PHP + c-preprocessor for my tastes, with things
like $variables and #directives or whatnot.

-Kai





-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to