tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc B├Ąchinger <>
Subject Re: ajax response from tomcat by including JSP from a servlet - fails silently when HTML is badly formed.
Date Sun, 04 Jun 2006 11:22:08 GMT
Am Sonntag, 4. Juni 2006 12.08 schrieb Mladen Adamovic:
> Andrew Braae wrote:
> > However if the JSP that produces the HTML content produces anything less
> > than perfectly-formed HTML, then the response fails - worse still, it
> > fails
> > silently, with no output to the tomcat log files.
> You can generate malformed HTML from JSP pages and it is OK, so I assume
> your problem is in rico or ajax related stuff. I think your problem is
> on the client side - client doesn't know to handle imperfectly formed
> HTML in ajax response.
> I had JSP which had errors and warnings  in HTML validator  :) But no
> problem in Tomcat with that :).

Thats my experience too. Tomcat sends the malformed response even if the 
contentType is text/xml. I'm very ok with this behaviour; TC should not parse 
the output by default.

This may confuse at the client side. Eg. Firefox does write a warning to the 
javascript console if the xmlResponse is malformed, but no error is thrown. 
The response will be available as text but not as parsed dom object. A 
JavaScript programmer not aware of this may think there is no response at 

To be aware of malformed xml on the tomcat side a servletfilter could be 
configured which parses the response and reports error to the log (the filter 
could be removed after developing phases). Another approach with xml taglibs 
would help avoiding such validation issues too:

Don't know what recent JSTL does offer. Third party taglib from Google eg.:


To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message