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 HTML. 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 log4j.properties 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 { response.setContentType("text/xml"); PrintWriter out = response.getWriter(); out.print("<ajax-response><response type=\"object\" id=\"myresponse\"><myresponsedata>"); // standard rico format request.getRequestDispatcher("/jsp/MyJSP.jsp").include(request, response); // dispatch to jsp out.print("</myresponsedata></response></ajax-response>"); out.close(); return; } This is the JSP that I call from the servlet.... <%@ page import="com.mystuff.*" %> <!-- this fails --> Hello<br>World 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 import="com.mystuff.*" %> <!-- 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.