Hi Jan

I'm relatively new to struts - but have come from a background of using XSLT
with Servlet2.3 filters.

Have to say this worked great, although as people have pointed out there is
a performance hit. But I found with optimization I could reduce this to a
nearly negligible amount (I also used SAXON - which is great and has
improved quite a bit in recent releases performance wise.)

I have a working site using XSLT, but it was written and maintained purely
by me - so it was a nightmare for other people to support - as all the
presentation stuff was in the XSL, i.e. raw XML data (from app server)
driving XSLT sheets with embedded HTML/WML etc.

This lead me to want to split out the data some more and have 2 XML streams
- one describing the data and one describing the presentation (sounding
familiar yet?) which I implemented myself using XSLT URIResolvers.

Around this time I also discovered Cocoon and spent an interesting, but
ultimately unfruitful, time evaluating and porting to it. It has a lot of
nice features (many of which I'd already implemented for myself previously -
annoyingly :), but I realized that what I was ultimately doing with my dual
XML data flows was effectively implementing custom tags using XSLT. (Also
see Cocoons XSP templating language)

E.g. In your presentation XML you write something like 
<sidebar>
        <entry><username/></entry>
</sidebar>

And in your XSLT you have something like:
<xsl:template match="sidebar">
        <table>
                <!-- Write your entries here sort of thing -->
        </table>
</xsl:template>

You also find your self wanting to substitute data values for elements which
may come from secondary XML streams or you may want to read values directly
from Java classes. This becomes a lot more cumbersome. XSLT - Java bindings
are non standard and mostly awkward to use.

Then I (re-)found JSP and Struts. Taglibs have come a long way since I last
looked at JSPs about 2 years ago and I realized I had the solution to my
problem. Use JSP to generate the presentation layer (as it was meant to do)
and use the taglibs provided by struts and Jakarta. The presentation is
still separated out, using Java to access data is much simplified, and I can
still bring in my XML data using the xtags library.

Currently I am not planning on using XSLT at all for the moment (which makes
me sad as I love it). Although I am considering that it may be useful in
i18n, as I don't like all the properties files you get from the taglib. And
it may be useful in defining on the fly look and feels by restructuring your
XHTML etc.

I'm still not ultimately convinced JSP/Struts is the 'best' way - and in
general I liked cocoon. But now there are so many useful tag libraries
(including support for XSLT) why go re-invent them yourself in XSLT? Plus
ultimately when it comes to getting someone to support my pages when I want
to move on to the next new thing ;-) I know I'm going to find it easier to
find someone to support a JSP/Struts solution than my own bespoke XSLT one!

Hope some of those ramblings were useful.

Luke




--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to