WM JSP Taglib progress and call for opinions/more whinging

"Marc Palmer" <[email protected]>
Newsgroups gmane.comp.java.webmacro.user
Message-ID <[email protected]>
Hi guys,

I have a WM JSP taglib working here. It works like this... in your JSP
page you do:

<wm:template>
    #foreach $reason in ["a", "very", "long", "list"]
       Use webmacro!
    #end
</wm:template>

I also have (currently untested) support for (which Velocity JSP taglib
doesn't do):

<wm:template template="someTemplatePath.wm"/>

However there are issues with template resolution in webapps - I can't
create WM to use a Servlet as there may not be one that can apply to the
taglib.

What I am now adding is a context tool to allow the WM script to access
the attributes of the JSP page in their various scopes (AKA scoped page
variables, scoped to page, session or request)

I'm not sure about the nicest way to achieve this. I'm currently working
along the lines of:

<wm:template>
This is from the JSP page context: $Attributes.Session.SomeSessionVar
This is from the JSP page context: $Attributes.Page.SomePageVar
This is from the JSP page context: $Attributes.Request.SomeRequestVar
</wm:template>

This would be quite a nice way to tackle the scoping problem without
requiring method calls (one of the main benefits of WM over JSP).

One thing that is annoying me is that we still can't seem to write
templates out to a Writer, only a FastWriter or OutputStream. 

In some ways this is good but in others it seems to suck. i.e. in JSP-land
the taglib has access only to a pre-constructed JspWriter to write out the
content. Currently I have to get ugly and create a ByteArrayOutputStream,
write to there, convert that to a String, then write that to the writer.
Quite nasty - although it does allow our WM evalution to be atomic - i.e.
any errors we can just dump a single error text to the JSP output.

I'll keep you all posted on the progress of this. We have a bunch of
legacy JSP pages here we will probably be converting to use this taglib so
there will be plenty of lessons learned, which I will put on the Wiki
eventually.

Cheers



-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.