Hello fellow users,

I'm working on a project that allows users of web-page designers (like DreamWeaver & GoLive) to easily generate JSP's that can manipulate data from an XML source (a bean, a file, a stream, etc).  The generated JSP's are then run in the Tomcat webserver.

One problem I have is that the mark-up language generated by these web-page design tools is not well-formed (i.e. non-matching tags, attributes w/o values, etc.)  Thus, the JSP itself is not well formed.  That, in itself is not really a problem for browsers and such, as they all allow badly-formed markup (mostly for historical reasons).  But badly formed mark-up is a problem for me.  Why?  In order to manipulate the XML data I need to send sections of the JSP file (tag bodies) through an XSLT processor - and XSLT requires that all markup is well-formed.  I can use a product like "tidy" to do the fixing up (with some extensions we've added).  Or I may want to precompile some of the XSL using the XSLTC compiler (and need to extract it from the JSP file - must be well-formed here too).

Anyway, all this requires that am able to manipulate and modify the generated JSP file before it's loaded by Tomcat.  Currently, I require that the user use a standalone tool that is run after they've used the the design tool and before they try out the JSP in their web server.  We also have a bit of the solution embedded in a tag library we provide - doing some of the work at run-time.  

But the standalone step is not a very seamless or transparent integration, and I was wondering whether Tomcat 4.0 provides an API whereby one can actually intercept the initial loading of a JSP (i.e. via some kind of Java interface implementation that is registered with the web server).

I'm not familiar with the 4.0 API, but I would need something that would allow user server code to recognize that Tomcat was about to load a JSP file, and allow the user code to manipulate the contents of the file before letting Tomcat load it.  In my case, for example, at the point of notification that one of my JSP files was about to be loaded, I would run "tidy", apply a couple of expansions needed for XSLT, and possibly extract out regions from the file and compile them using XSLTC (putting the resulting Java classes in a well known place).

I've looked around a bit, but haven't found too much about this.  If anyone familiar with the Tomcat 4.0 API can provide me with any answer of whether this is doable, or some alternative could you please reply.

Thanks
Neil Goodman

[EMAIL PROTECTED]
(510) 869-3418

Reply via email to