Hi Tim, Thanx for the information - I forgot about that. I guess the question is why did it work in Tomcat 3 and not Tomcat 4 and second is there a workaround to get it to work?
Adile -----Original Message----- From: Tim Funk [mailto:[EMAIL PROTECTED] Sent: July 22, 2005 12:20 PM To: Tomcat Users List Subject: Re: Error 500 messages This line <jsp:include page="top.html" flush="true"> will commit the response and send html back to the client. Once that is done - no error messages will be sent back to the client and you will end up with a blank screen. -Tim Adile Abbadi wrote: > Hi Rob, > > Thanx for this - this is great - I may have to use this because I think I > have truly found a bug in Tomcat as this issue is not happening on my Tomcat > 3 server. I did a bit more investigation and I found some interesting > things. This is going to be a long email with code and stuff but whoever > wants to read it please do - because the results are weird. > > I created the following simple JSP page > > <%@ page language="java" > import="javax.crypto.*,java.sql.*,java.net.*,dbc.DBConnectionManager" %> > <%^M > String query = "select * from patient_info where ref_client = 38 and > pat_lname like '%SM'ITH%';"; > DBConnectionManager connMgr; > connMgr = DBConnectionManager.getInstance(); > Connection Conn = connMgr.getConnection("podb"); > Statement SQLS = Conn.createStatement(); > ResultSet rs = SQLS.executeQuery(query); > String col1 = null; > String col2 = null; > while(rs.next()) { > col1 = rs.getString("pat_id"); > col2 = rs.getString("pat_fname"); > %> > <%=col1%>: <%=col2%><br> > <br> > <% > } > rs.close(); > SQLS.close(); > connMgr.freeConnection("podb",Conn); > %> > > As you can see I did a syntax error in the query and the error comes to the > screen as expected > > javax.servlet.ServletException: ERROR: syntax error at or near "ITH" at > character 74 > > I said that's weird so I tried to compare my complicated JSP files to what I > have here to see what is different (if I did something wrong) and I found > this > > If I add an include at certain parts of the page - I see the result I was > talking about. For example if I do this: > > <jsp:include page="top.html" flush="true"> > <%@ page language="java" > import="javax.crypto.*,java.sql.*,java.net.*,dbc.DBConnectionManager" %> > <%^M > String query = "select * from patient_info where ref_client = 38 and > pat_lname like '%SM'ITH%';"; > DBConnectionManager connMgr; > connMgr = DBConnectionManager.getInstance(); > Connection Conn = connMgr.getConnection("podb"); > Statement SQLS = Conn.createStatement(); > ResultSet rs = SQLS.executeQuery(query); > String col1 = null; > String col2 = null; > while(rs.next()) { > col1 = rs.getString("pat_id"); > col2 = rs.getString("pat_fname"); > %> > <%=col1%>: <%=col2%><br> > <br> > <% > } > rs.close(); > SQLS.close(); > connMgr.freeConnection("podb",Conn); > %> > > I get the error page as I should - however If I move the include to below > the <%@ page language="java".... - I get a blank page!! > > Now here is where it gets weirder - if I force a java syntax error like as > follows (I corrected the query): > > <jsp:include page="top.html" flush="true"> > <%@ page language="java" > import="javax.crypto.*,java.sql.*,java.net.*,dbc.DBConnectionManager" %> > <%^M > String query = "select * from patient_info where ref_client = 38 and > pat_lname like '%SMITH%';"; > DBConnectionManager connMgr; > connMgr = DBConnectionManager.getInstance(); > Connection Conn = connMgr.getConnection("podb"); > Statement SQLS = Conn.createStatement(); > ResultSet rs = SQLS.executeQuery(query); > String col1 = null; > String col2 = null; > if (col1.equals("yes") { > //test > } > while(rs.next()) { > col1 = rs.getString("pat_id"); > col2 = rs.getString("pat_fname"); > %> > <%=col1%>: <%=col2%><br> > <br> > <% > } > rs.close(); > SQLS.close(); > connMgr.freeConnection("podb",Conn); > %> > > An error will get thrown to the screen > > org.apache.jasper.JasperException: Unable to compile class for JSP > > An error occurred at line: 2 in the jsp file: /testdb.jsp > > /var/lib/tomcat4/work/Standalone/localhost/podims/testdb_jsp.java:57: ')' > expected > if (col1.equals("yes") { > > However if I try to force a null pointer error by correcting my syntax > error - I get a blank screen! If remove the include I get the null pointer > error no problem. The other behaviour I noticed as well is that as I said > before if the include is above the <%@ page language.... piece it works > fine - only if its an html - if its another jsp file - I get a blank screen > as well. > > So has anyone else seen this behaviour - is there a fix or a work around - > should I got back to Tomcat 3?? I'm going to try your suggestion Rob and see > if that helps at all, but to me its seems like an issue with the JSP > compiler. > > Cheers > > Adile > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.338 / Virus Database: 267.9.2/55 - Release Date: 7/21/05 -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.338 / Virus Database: 267.9.2/55 - Release Date: 7/21/05 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
