Loading ...
Sorry, an error occurred while loading the content.
 

[Cheetahtemplate-discuss] How to use JSP directives in a Cheetah template?

Expand Messages
  • Peter White
    First off, I want to compliment you guys on creating an excellent product! I just started playing with Python and Cheetah, for the first time, two nights ago
    Message 1 of 6 , Dec 2, 2003
      How to use JSP directives in a Cheetah template?

      First off, I want to compliment you guys on creating an excellent product! I just started playing with Python and Cheetah, for the first time, two nights ago and have already written a code generator that creates my Java domain objects, data access objects and MVC-controller action code - this has definitely changed the way I think about application development! However, I just ran into my first hurdle while attempting to generate JSPs….

      My JSP contains directives such as:

      <%@ page import="${model.name}" %>

      While attempting to process the template, I get the following error:

      File "<string>", line 28
           @ page import="${model.name}"
           ^
       SyntaxError: invalid syntax

      I realize I can't write the above line as:

      #raw<%@ page import="#end raw${model.name}"#raw%>#end raw

      What's the easiest/cleanest looking way to make template text like this work with Cheetah?

      Thanks in advance!
      Peter

    • Peter White
      As a follow-up, I just tried the following, which worked, but I m open to better suggestions... #set beginDirective =
      Message 2 of 6 , Dec 2, 2003
        How to use JSP directives in a Cheetah template?
        As a follow-up, I just tried the following, which worked, but I'm open to better suggestions...
         
        #set beginDirective = "<%@"
        #set endDirective = "%>"
        $beginDirective page import="${model.name}" $endDirective


        From: cheetahtemplate-discuss-admin@... [mailto:cheetahtemplate-discuss-admin@...] On Behalf Of Peter White
        Sent: Tuesday, December 02, 2003 5:53 PM
        To: cheetahtemplate-discuss@...
        Subject: [Cheetahtemplate-discuss] How to use JSP directives in a Cheetah template?

        First off, I want to compliment you guys on creating an excellent product! I just started playing with Python and Cheetah, for the first time, two nights ago and have already written a code generator that creates my Java domain objects, data access objects and MVC-controller action code - this has definitely changed the way I think about application development! However, I just ran into my first hurdle while attempting to generate JSPs….

        My JSP contains directives such as:

        <%@ page import="${model.name}" %>

        While attempting to process the template, I get the following error:

        File "<string>", line 28
             @ page import="${model.name}"
             ^
         SyntaxError: invalid syntax

        I realize I can't write the above line as:

        #raw<%@ page import="#end raw${model.name}"#raw%>#end raw

        What's the easiest/cleanest looking way to make template text like this work with Cheetah?

        Thanks in advance!
        Peter

      • Tavis Rudd
        Hi Peter, Cheetah s parser thinks you re trying to include psp code that should execute. Try adding this to the beginning of your template: #compiler-setting
        Message 3 of 6 , Dec 2, 2003
          Hi Peter,
          Cheetah's parser thinks you're trying to include psp code that should execute.
          Try adding this to the beginning of your template:
          #compiler-setting PSPStartToken='**SomeRandomCrap**'
          #compiler-setting PSPEndToken='**SomeRandomCrap**'

          Cheers,
          Tavis


          On Tuesday 02 December 2003 17:59, Peter White wrote:
          > As a follow-up, I just tried the following, which worked, but I'm open to
          > better suggestions...
          >
          > #set beginDirective = "<%@"
          > #set endDirective = "%>"
          > $beginDirective page import="${model.name}" $endDirective
          >
          >
          > _____
          >
          > From: cheetahtemplate-discuss-admin@...
          > [mailto:cheetahtemplate-discuss-admin@...] On Behalf Of
          > Peter White
          > Sent: Tuesday, December 02, 2003 5:53 PM
          > To: cheetahtemplate-discuss@...
          > Subject: [Cheetahtemplate-discuss] How to use JSP directives in a Cheetah
          > template?
          >
          >
          >
          > First off, I want to compliment you guys on creating an excellent product!
          > I just started playing with Python and Cheetah, for the first time, two
          > nights ago and have already written a code generator that creates my Java
          > domain objects, data access objects and MVC-controller action code - this
          > has definitely changed the way I think about application development!
          > However, I just ran into my first hurdle while attempting to generate
          > JSPs..
          >
          > My JSP contains directives such as:
          >
          > <%@ page import="${model.name}" %>
          >
          > While attempting to process the template, I get the following error:
          >
          > File "<string>", line 28
          > @ page import="${model.name}"
          > ^
          > SyntaxError: invalid syntax
          >
          > I realize I can't write the above line as:
          >
          > #raw<%@ page import="#end raw${model.name}"#raw%>#end raw
          >
          > What's the easiest/cleanest looking way to make template text like this
          > work with Cheetah?
          >
          > Thanks in advance!
          > Peter



          -------------------------------------------------------
          This SF.net email is sponsored by OSDN's Audience Survey.
          Help shape OSDN's sites and tell us what you think. Take this
          five minute survey and you could win a $250 Gift Certificate.
          http://www.wrgsurveys.com/2003/osdntech03.php?site=8
          _______________________________________________
          Cheetahtemplate-discuss mailing list
          Cheetahtemplate-discuss@...
          https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
        • Peter White
          Hi Tavis, I tried that, got errors, looked at Parser.py and found compiler-settings so I added the s and got errors, and eventually just set
          Message 4 of 6 , Dec 2, 2003
            Hi Tavis,

            I tried that, got errors, looked at Parser.py and found compiler-settings so
            I added the 's' and got errors, and eventually just set
            'PSPStartToken':'<%%' and 'PSPEndToken':'%%>' in Parser.py and it works like
            a charm. Thanks for the pointer and the quick response!

            -Peter

            > -----Original Message-----
            > From: cheetahtemplate-discuss-admin@...
            > [mailto:cheetahtemplate-discuss-admin@...]
            > On Behalf Of Tavis Rudd
            > Sent: Tuesday, December 02, 2003 6:41 PM
            > To: pwhite2@...; cheetahtemplate-discuss@...
            > Subject: Re: [Cheetahtemplate-discuss] How to use JSP
            > directives in a Cheetah template?
            >
            > Hi Peter,
            > Cheetah's parser thinks you're trying to include psp code
            > that should execute.
            > Try adding this to the beginning of your template:
            > #compiler-setting PSPStartToken='**SomeRandomCrap**'
            > #compiler-setting PSPEndToken='**SomeRandomCrap**'
            >
            > Cheers,
            > Tavis
            >
            >
            > On Tuesday 02 December 2003 17:59, Peter White wrote:
            > > As a follow-up, I just tried the following, which worked,
            > but I'm open
            > > to better suggestions...
            > >
            > > #set beginDirective = "<%@"
            > > #set endDirective = "%>"
            > > $beginDirective page import="${model.name}" $endDirective
            > >
            > >
            > > _____
            > >
            > > From: cheetahtemplate-discuss-admin@...
            > >
            > [mailto:cheetahtemplate-discuss-admin@...]
            > On Behalf
            > > Of Peter White
            > > Sent: Tuesday, December 02, 2003 5:53 PM
            > > To: cheetahtemplate-discuss@...
            > > Subject: [Cheetahtemplate-discuss] How to use JSP directives in a
            > > Cheetah template?
            > >
            > >
            > >
            > > First off, I want to compliment you guys on creating an
            > excellent product!
            > > I just started playing with Python and Cheetah, for the first time,
            > > two nights ago and have already written a code generator
            > that creates
            > > my Java domain objects, data access objects and
            > MVC-controller action
            > > code - this has definitely changed the way I think about
            > application development!
            > > However, I just ran into my first hurdle while attempting
            > to generate
            > > JSPs..
            > >
            > > My JSP contains directives such as:
            > >
            > > <%@ page import="${model.name}" %>
            > >
            > > While attempting to process the template, I get the following error:
            > >
            > > File "<string>", line 28
            > > @ page import="${model.name}"
            > > ^
            > > SyntaxError: invalid syntax
            > >
            > > I realize I can't write the above line as:
            > >
            > > #raw<%@ page import="#end raw${model.name}"#raw%>#end raw
            > >
            > > What's the easiest/cleanest looking way to make template text like
            > > this work with Cheetah?
            > >
            > > Thanks in advance!
            > > Peter
            >
            >
            >
            > -------------------------------------------------------
            > This SF.net email is sponsored by OSDN's Audience Survey.
            > Help shape OSDN's sites and tell us what you think. Take this
            > five minute survey and you could win a $250 Gift Certificate.
            > http://www.wrgsurveys.com/2003/osdntech03.php?site=8
            > _______________________________________________
            > Cheetahtemplate-discuss mailing list
            > Cheetahtemplate-discuss@...
            > https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
            >




            -------------------------------------------------------
            This SF.net email is sponsored by OSDN's Audience Survey.
            Help shape OSDN's sites and tell us what you think. Take this
            five minute survey and you could win a $250 Gift Certificate.
            http://www.wrgsurveys.com/2003/osdntech03.php?site=8
            _______________________________________________
            Cheetahtemplate-discuss mailing list
            Cheetahtemplate-discuss@...
            https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
          • Tavis Rudd
            oops, it should have been #compiler PSPStartToken = ... Sorry about that - I was typing from memory. Cheers, Tavis ... This SF.net email is sponsored by
            Message 5 of 6 , Dec 2, 2003
              oops, it should have been
              #compiler PSPStartToken = '...'
              Sorry about that - I was typing from memory.

              Cheers,
              Tavis

              On Tuesday 02 December 2003 19:09, Peter White wrote:
              > Hi Tavis,
              >
              > I tried that, got errors, looked at Parser.py and found compiler-settings
              > so I added the 's' and got errors, and eventually just set
              > 'PSPStartToken':'<%%' and 'PSPEndToken':'%%>' in Parser.py and it works
              > like a charm. Thanks for the pointer and the quick response!
              >
              > -Peter
              >
              > > -----Original Message-----
              > > From: cheetahtemplate-discuss-admin@...
              > > [mailto:cheetahtemplate-discuss-admin@...]
              > > On Behalf Of Tavis Rudd
              > > Sent: Tuesday, December 02, 2003 6:41 PM
              > > To: pwhite2@...; cheetahtemplate-discuss@...
              > > Subject: Re: [Cheetahtemplate-discuss] How to use JSP
              > > directives in a Cheetah template?
              > >
              > > Hi Peter,
              > > Cheetah's parser thinks you're trying to include psp code
              > > that should execute.
              > > Try adding this to the beginning of your template:
              > > #compiler-setting PSPStartToken='**SomeRandomCrap**'
              > > #compiler-setting PSPEndToken='**SomeRandomCrap**'
              > >
              > > Cheers,
              > > Tavis
              > >
              > > On Tuesday 02 December 2003 17:59, Peter White wrote:
              > > > As a follow-up, I just tried the following, which worked,
              > >
              > > but I'm open
              > >
              > > > to better suggestions...
              > > >
              > > > #set beginDirective = "<%@"
              > > > #set endDirective = "%>"
              > > > $beginDirective page import="${model.name}" $endDirective
              > > >
              > > >
              > > > _____
              > > >
              > > > From: cheetahtemplate-discuss-admin@...
              > >
              > > [mailto:cheetahtemplate-discuss-admin@...]
              > > On Behalf
              > >
              > > > Of Peter White
              > > > Sent: Tuesday, December 02, 2003 5:53 PM
              > > > To: cheetahtemplate-discuss@...
              > > > Subject: [Cheetahtemplate-discuss] How to use JSP directives in a
              > > > Cheetah template?
              > > >
              > > >
              > > >
              > > > First off, I want to compliment you guys on creating an
              > >
              > > excellent product!
              > >
              > > > I just started playing with Python and Cheetah, for the first time,
              > > > two nights ago and have already written a code generator
              > >
              > > that creates
              > >
              > > > my Java domain objects, data access objects and
              > >
              > > MVC-controller action
              > >
              > > > code - this has definitely changed the way I think about
              > >
              > > application development!
              > >
              > > > However, I just ran into my first hurdle while attempting
              > >
              > > to generate
              > >
              > > > JSPs..
              > > >
              > > > My JSP contains directives such as:
              > > >
              > > > <%@ page import="${model.name}" %>
              > > >
              > > > While attempting to process the template, I get the following error:
              > > >
              > > > File "<string>", line 28
              > > > @ page import="${model.name}"
              > > > ^
              > > > SyntaxError: invalid syntax
              > > >
              > > > I realize I can't write the above line as:
              > > >
              > > > #raw<%@ page import="#end raw${model.name}"#raw%>#end raw
              > > >
              > > > What's the easiest/cleanest looking way to make template text like
              > > > this work with Cheetah?
              > > >
              > > > Thanks in advance!
              > > > Peter
              > >
              > > -------------------------------------------------------
              > > This SF.net email is sponsored by OSDN's Audience Survey.
              > > Help shape OSDN's sites and tell us what you think. Take this
              > > five minute survey and you could win a $250 Gift Certificate.
              > > http://www.wrgsurveys.com/2003/osdntech03.php?site=8
              > > _______________________________________________
              > > Cheetahtemplate-discuss mailing list
              > > Cheetahtemplate-discuss@...
              > > https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
              >
              > -------------------------------------------------------
              > This SF.net email is sponsored by OSDN's Audience Survey.
              > Help shape OSDN's sites and tell us what you think. Take this
              > five minute survey and you could win a $250 Gift Certificate.
              > http://www.wrgsurveys.com/2003/osdntech03.php?site=8
              > _______________________________________________
              > Cheetahtemplate-discuss mailing list
              > Cheetahtemplate-discuss@...
              > https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss



              -------------------------------------------------------
              This SF.net email is sponsored by OSDN's Audience Survey.
              Help shape OSDN's sites and tell us what you think. Take this
              five minute survey and you could win a $250 Gift Certificate.
              http://www.wrgsurveys.com/2003/osdntech03.php?site=8
              _______________________________________________
              Cheetahtemplate-discuss mailing list
              Cheetahtemplate-discuss@...
              https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
            • Peter White
              That did the trick, thanks! ... This SF.net email is sponsored by OSDN s Audience Survey. Help shape OSDN s sites and tell us what you think. Take this five
              Message 6 of 6 , Dec 2, 2003
                That did the trick, thanks!

                > -----Original Message-----
                > From: cheetahtemplate-discuss-admin@...
                > [mailto:cheetahtemplate-discuss-admin@...]
                > On Behalf Of Tavis Rudd
                > Sent: Tuesday, December 02, 2003 7:18 PM
                > To: pwhite2@...
                > Cc: cheetahtemplate-discuss@...
                > Subject: Re: [Cheetahtemplate-discuss] How to use JSP
                > directives in a Cheetah template?
                >
                > oops, it should have been
                > #compiler PSPStartToken = '...'
                > Sorry about that - I was typing from memory.
                >
                > Cheers,
                > Tavis
                >
                > On Tuesday 02 December 2003 19:09, Peter White wrote:
                > > Hi Tavis,
                > >
                > > I tried that, got errors, looked at Parser.py and found
                > > compiler-settings so I added the 's' and got errors, and eventually
                > > just set 'PSPStartToken':'<%%' and 'PSPEndToken':'%%>' in Parser.py
                > > and it works like a charm. Thanks for the pointer and the
                > quick response!
                > >
                > > -Peter
                > >
                > > > -----Original Message-----
                > > > From: cheetahtemplate-discuss-admin@...
                > > > [mailto:cheetahtemplate-discuss-admin@...]
                > > > On Behalf Of Tavis Rudd
                > > > Sent: Tuesday, December 02, 2003 6:41 PM
                > > > To: pwhite2@...;
                > cheetahtemplate-discuss@...
                > > > Subject: Re: [Cheetahtemplate-discuss] How to use JSP
                > directives in
                > > > a Cheetah template?
                > > >
                > > > Hi Peter,
                > > > Cheetah's parser thinks you're trying to include psp code that
                > > > should execute.
                > > > Try adding this to the beginning of your template:
                > > > #compiler-setting PSPStartToken='**SomeRandomCrap**'
                > > > #compiler-setting PSPEndToken='**SomeRandomCrap**'
                > > >
                > > > Cheers,
                > > > Tavis
                > > >
                > > > On Tuesday 02 December 2003 17:59, Peter White wrote:
                > > > > As a follow-up, I just tried the following, which worked,
                > > >
                > > > but I'm open
                > > >
                > > > > to better suggestions...
                > > > >
                > > > > #set beginDirective = "<%@"
                > > > > #set endDirective = "%>"
                > > > > $beginDirective page import="${model.name}" $endDirective
                > > > >
                > > > >
                > > > > _____
                > > > >
                > > > > From: cheetahtemplate-discuss-admin@...
                > > >
                > > > [mailto:cheetahtemplate-discuss-admin@...]
                > > > On Behalf
                > > >
                > > > > Of Peter White
                > > > > Sent: Tuesday, December 02, 2003 5:53 PM
                > > > > To: cheetahtemplate-discuss@...
                > > > > Subject: [Cheetahtemplate-discuss] How to use JSP
                > directives in a
                > > > > Cheetah template?
                > > > >
                > > > >
                > > > >
                > > > > First off, I want to compliment you guys on creating an
                > > >
                > > > excellent product!
                > > >
                > > > > I just started playing with Python and Cheetah, for the first
                > > > > time, two nights ago and have already written a code generator
                > > >
                > > > that creates
                > > >
                > > > > my Java domain objects, data access objects and
                > > >
                > > > MVC-controller action
                > > >
                > > > > code - this has definitely changed the way I think about
                > > >
                > > > application development!
                > > >
                > > > > However, I just ran into my first hurdle while attempting
                > > >
                > > > to generate
                > > >
                > > > > JSPs..
                > > > >
                > > > > My JSP contains directives such as:
                > > > >
                > > > > <%@ page import="${model.name}" %>
                > > > >
                > > > > While attempting to process the template, I get the
                > following error:
                > > > >
                > > > > File "<string>", line 28
                > > > > @ page import="${model.name}"
                > > > > ^
                > > > > SyntaxError: invalid syntax
                > > > >
                > > > > I realize I can't write the above line as:
                > > > >
                > > > > #raw<%@ page import="#end raw${model.name}"#raw%>#end raw
                > > > >
                > > > > What's the easiest/cleanest looking way to make
                > template text like
                > > > > this work with Cheetah?
                > > > >
                > > > > Thanks in advance!
                > > > > Peter
                > > >
                > > > -------------------------------------------------------
                > > > This SF.net email is sponsored by OSDN's Audience Survey.
                > > > Help shape OSDN's sites and tell us what you think. Take
                > this five
                > > > minute survey and you could win a $250 Gift Certificate.
                > > > http://www.wrgsurveys.com/2003/osdntech03.php?site=8
                > > > _______________________________________________
                > > > Cheetahtemplate-discuss mailing list
                > > > Cheetahtemplate-discuss@...
                > > >
                > https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
                > >
                > > -------------------------------------------------------
                > > This SF.net email is sponsored by OSDN's Audience Survey.
                > > Help shape OSDN's sites and tell us what you think. Take this five
                > > minute survey and you could win a $250 Gift Certificate.
                > > http://www.wrgsurveys.com/2003/osdntech03.php?site=8
                > > _______________________________________________
                > > Cheetahtemplate-discuss mailing list
                > > Cheetahtemplate-discuss@...
                > > https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
                >
                >
                >
                > -------------------------------------------------------
                > This SF.net email is sponsored by OSDN's Audience Survey.
                > Help shape OSDN's sites and tell us what you think. Take this
                > five minute survey and you could win a $250 Gift Certificate.
                > http://www.wrgsurveys.com/2003/osdntech03.php?site=8
                > _______________________________________________
                > Cheetahtemplate-discuss mailing list
                > Cheetahtemplate-discuss@...
                > https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
                >




                -------------------------------------------------------
                This SF.net email is sponsored by OSDN's Audience Survey.
                Help shape OSDN's sites and tell us what you think. Take this
                five minute survey and you could win a $250 Gift Certificate.
                http://www.wrgsurveys.com/2003/osdntech03.php?site=8
                _______________________________________________
                Cheetahtemplate-discuss mailing list
                Cheetahtemplate-discuss@...
                https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
              Your message has been successfully submitted and would be delivered to recipients shortly.