cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Stevens <>
Subject JSP integration
Date Tue, 03 Jul 2007 00:19:31 GMT


In the past I've used a few different JSPEngine implementations with the (2.1.x) JSP generator
& reader.  On iPlanet there was one that was configured with the fully qualified class
name of its JSP servlet (can't remember offhand which one it was, but that's not important).
 On Websphere I'm using one that looks it up based on the servlet name ("JSP 1.2 Processor"
or something like that).  However, sometimes (even on the same app server type) I've had to
tweak the configurations to avoid getting errors like "Text content found before prologue".
 Since switching settings to e.g. use RequestDispatcher.include() instead of .forward() fixes
this, I don't think there's actually anything wrong with the JSP output.  Best I can think
of is maybe it's struggling with a 0xFFFE UTF-8 byte-order marker prior to the initial xml
processing instruction.  But I digress.

I actually find the fact the JSP generator requires the JSP to produce valid (or at least
well-formed) XML is actually quite limiting.  I had to rewrite various exisiting JSPs that
were producing HTML, to output a single top-level DIV element and make the rest valid XHTML;
with other static HTML files I just used the jtidy or neko generators to clean them up instead.

My first thought was to create a modified JSP generator component that passed the output through
neko/jdity before parsing it.  And then inspiration hit - why not instead create a new input
Source for JSPs?  That way, JSPs that produce XML can be processed by the default (file!)
generator, ones that produce HTML can be processed by the HTML generator, and you could even
have ones that produce CSV be processed by (you guessed it) the CSVGenerator.  Seems much
more flexible to me.

And then I started to over-think it :-)  Why only JSPs?  Why not servlets too?  How does this
differ from the context: source type?  Surely someone must have thought of doing this before
- is there no similar facility already?  What about in Cocoon 2.2 - would the servlet/blocks
framework that keeps getting discussed cater for this anyway?
At which point I figured the best thing to do was to dump my thoughts to the list and see
if anyone had any feedback or suggestions...

So, what about it?  Would this be a useful addition to the JSP block?  Or is there already
a similar facility that I'm overlooking?


Feel like a local wherever you go with
View raw message