tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Braae" <>
Subject ajax response from tomcat by including JSP from a servlet - fails silently when HTML is badly formed.
Date Sat, 03 Jun 2006 22:23:24 GMT
I am having great trouble with an error that does not show up in the tomcat
logging. Hours of googling and frigging around and I am no closer. Would
really appreciate any help on this one.

Basically I am using a blend of servlets and JSP to build up a response to
an ajax request (using rico on the browser). The response itself is a
fragment of HTML, wrapped inside some XML.

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. This makes debugging a
nightmare of examining every line of the JSP searching for badly-formed

I really need to get tomcat logging working so that I can see the error that
is occurring. I am using Tomcat 5.5, with the basic setup
and file as per tomcat distribution.

For example my code is as follows:

// this is my controller servlet
public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws IOException, ServletException    {

   PrintWriter out = response.getWriter();

   out.print("<ajax-response><response type=\"object\"
id=\"myresponse\"><myresponsedata>"); // standard rico format

response); // dispatch to jsp



This is the JSP that I call from the servlet....

<%@ page
<!-- this fails -->

The above JSP will fail, silently - however if I change the JSP so that the
<br> tag is strictly correct XHTML, then it works fine...

<%@ page
<!-- this works!-->
Hello<br />World

Among the many things I have tried to resolve this problem are:
1) wrapping the HTML response inside CDATA
2) Flushing out before and after JSP invocation
3) Using text/html instead of text/xml, and even just not setting content
type at all.

Any assistance greatly appreciated. As I say, I would really like to get the
tomcat logging working, though would also be happy if there was some way to
repvent tomcat from being so harsh, and allowing manky HTML through.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message