On 3/15/06, Serge Knystautas <[EMAIL PROTECTED]> wrote: > On 3/14/06, Nathan Bubna <[EMAIL PROTECTED]> wrote: > > > 1. I don't see how I can use tags with body content. Freemarker > > > syntactally supports tag invocations similar to a foreach loop, but > > > without changing velocity's syntax, I can't see any way to provide > > > similar capabilities. Do you have any ideas on this? > > > > i think i'd have to see some of the code before i can suggest many > > ideas. Velocity does support custom directives that take body > > content. i think WebWork took this route when creating their tag > > support for Velocity. > > Can you point me to how custom directives could take body content (a > doc page, some sample code, whatever)?
sure. all of the standard directives that take body content are good examples. you might be most interested in #literal() since it takes body content and does nothing with it. :) http://svn.apache.org/viewcvs.cgi/jakarta/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Literal.java?rev=369042&view=markup > > > 2. Do you have any ideas on syntax for how to access a tag invoker? > > > > very tough call. it feels like there are only three options: > > The idea of passing body content to a tag opens my mind a lot. I had > been thinking of more limited ideas. > > In broad strokes, this is what my code is doing right now: > - creates the tag instance > - sets user attributes using beanutils (a new dependency I realize) this will probably go into VelocityTools 2.x eventually, so no worries about dependencies. > - creates a fake pageContext object based on a provided request object > - sets tag attributes that the JSP page usually would (parent, pagecontext) > - inits the tag > - runs the tag without support for body content > - destroys the tag > - returns what the tag spat out to its writer as a String sounds like a great start. > What is needed is: > - support for bodycontent > - support for looping (which wasn't necessary before body content was an > option) > - reading a TLD to understand the tag mappings > - figure out how you reference that you're using a TLD (what is this > library's equivalent of a taglib page declaration in JSP) > - instantiate a tag based on its short name in the TLD > - validate what attributes are passed according to the TLD the TLD stuff would be cool, but let's tackle this one thing at a time. :) > Some other thoughts: > - EL won't be supported. yeah, we shouldn't really need it either. especially if we take the tool route. then, if we're passing in attributes and body content as strings, then they'll be pre-rendered by Velocity (which is better than EL IMHO. :) > - nesting tags would be good... again I hadn't thought about this at > all because of no understanding that body content would be an option. wouldn't we need to gt the body content parsed and rendered by Jasper (or whatever) then? this seems like it could pose a great challenge. we should look into what others have done here (WebWork or Freemarker) and learn from them. > - syntax is completely up in the air still. I have to think about the > options you gave. pursue whatever seems most interesting/promising to you. > - .tag file support that Will mentioned... My 2 cents... I'm not that > concerned about this since Velocity can do the equivalent with macros. > I figure the best benefit of this (entire) feature is giving Velocity > developer access to some feature in a JSP taglib (like ajaxtags or > displaytag or jodatag), and I don't see anyone distributing these as > .tag files yet. agreed. > What I'll do is mockup the code I have and create a little war (or > something) that shows what at this point. i look forward to seeing it! > -- > Serge Knystautas > Lokitech >> software . strategy . design >> http://www.lokitech.com > p. 301.656.5501 > e. [EMAIL PROTECTED] > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
