I'm doing exactly this in Myna (http://www.mynajs.org/site/article/ MynaServerLanguageFeatures.ejs) by running the JS through a pre- processor and converting it to JavaScript before compiling. This also allows for embedded templating (see link above). If you are looking for a replacement/alternative to JSP, check it out.
On Dec 4, 5:33 pm, Henrik Lindqvist <[email protected]> wrote: > Hi, > > I'am planning on using Rhino as a replacement for JSP, soo I've hacked > the parser adding a optional feature to enable a similar syntax: > > -- cut -- > %><h1>Title</h1> > <ul> > <% for (var i = 1; i <= 10; i++) { %> > <li>Item #<%= i %></li> > <% } %> > </ul> > -- cut -- > > Now some questions: > > 1. Is anyone else interested is such a feature? > > 2. Would such a feature, properly implemented, ever be accepted to the > main trunk of the Rhino source? > > 3. If yes. Any tips on how to correctly implement this? I've now just > added an additional token '%>template text<%', the parser then creates > AST nodes to call a "print" function with the template text and '<%=' > expression as arguments. As said, currently a quick hack. > > / henrik _______________________________________________ dev-tech-js-engine-rhino mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino
