Re: #INCLUDE question
The README that comes with tomcat says how to turn on SSI. -Tim T S wrote: I have Tomcat 4.1.12 installed on WinXP. I am attempting to do an SSI and it appears that the command is not being recognized. Here is the command: !-- #INCLUDE file=js/CMS_header.js -- The include appears to NOT be occuring and I get no errors when I run the html. Do I need to set a setting in Tomcat to turn SSI on? If so, what must I do? Thank you for your help. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: #INCLUDE question
You'd save yourself some time if you took about 2 seconds to look at the docs Tomcat provides to see if your question is answered there before posting to this list. http://jakarta.apache.org/tomcat/tomcat-4.1-doc/index.html http://jakarta.apache.org/tomcat/tomcat-4.1-doc/ssi-howto.html Jake At 01:50 PM 2/22/2003 -0800, you wrote: I have Tomcat 4.1.12 installed on WinXP. I am attempting to do an SSI and it appears that the command is not being recognized. Here is the command: !-- #INCLUDE file=js/CMS_header.js -- The include appears to NOT be occuring and I get no errors when I run the html. Do I need to set a setting in Tomcat to turn SSI on? If so, what must I do? Thank you for your help. - Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, and more
RE: Include question...
Sure it is...just do this... % String sPage = index.jsp; if (myCondition()) { sPage = anotherPage.jsp; } else if (anotherCondition()) { sPage = yetAnother.jsp; } % jsp:include page=%= sPage % flush=true / Hope that helps. - Joel Kozlow -Original Message- From: Kyle Burke [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 23, 2001 10:40 AM To: Tomcat-Users Subject: Include question... Is this possible (see CODE)? I have a file that depends on the query string for display. Can I have include files based on that query string too? If action=edit show the data in form fields otherwise show it in formatted text. When the files are included vs. when the page is compiled and executed (see EXCEPTION). Thanks peops! EXCEPTION Unable to compile class 'try' without 'catch' or 'finally' but I dont have any exception handling in the page. /EXCEPTION CODE % if(action.equals(edit)){ % %@ include file=includes/edit_staff.jsp% % }else{ % %@ include file=includes/view_staff.jsp% % } % /CODE Kyle Burke
RE: Include question...
The problem is probably a syntax error such as a forgotten closing } or something like that. This disrupts the rest of the code when the page gets compiled in a servlet resulting in a try not being caught. Double-check the syntax in your jsp code. You can also open the servlet that Tomcat is trying to generate (see in the work folder of Tomcat), the stack trace points to the exact location of the problem. It might be easier to spot the problem in the servlet and then correct the jsp page. Gilles -Original Message- From: Kyle Burke [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 23, 2001 1:40 PM To: Tomcat-Users Subject: Include question... Is this possible (see CODE)? I have a file that depends on the query string for display. Can I have include files based on that query string too? If action=edit show the data in form fields otherwise show it in formatted text. When the files are included vs. when the page is compiled and executed (see EXCEPTION). Thanks peops! EXCEPTION Unable to compile class 'try' without 'catch' or 'finally' but I dont have any exception handling in the page. /EXCEPTION CODE % if(action.equals(edit)){ % %@ include file=includes/edit_staff.jsp% % }else{ % %@ include file=includes/view_staff.jsp% % } % /CODE Kyle Burke
RE: Include question...
Kyle, make sure you read up on your JSP includes -- the one that Joel is giving your works DIFFERENTLY than the include you were using before. Specifically, in your original example, it didn't work because the @ include happens during COMPILATION -- not during RUNTIME. Your problem was that you were trying to branch at runtime and that was just too late for a @ include. The include shown in Joel's code happens at runtime, that is why it works. However, it won't have any local variables available to it unless the are put into the request or into the session and retrieved on the next page (index.jsp, anotherPage.jsp, or yetAnother.jsp in Joel's example) There's quite a bit written about different JSP includes ... do some studying! -Original Message- From: Joel Kozlow [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 23, 2001 12:12 PM To: '[EMAIL PROTECTED]' Subject: RE: Include question... Sure it is...just do this... % String sPage = index.jsp; if (myCondition()) { sPage = anotherPage.jsp; } else if (anotherCondition()) { sPage = yetAnother.jsp; } % jsp:include page=%= sPage % flush=true / Hope that helps. - Joel Kozlow -Original Message- From: Kyle Burke [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 23, 2001 10:40 AM To: Tomcat-Users Subject: Include question... Is this possible (see CODE)? I have a file that depends on the query string for display. Can I have include files based on that query string too? If action=edit show the data in form fields otherwise show it in formatted text. When the files are included vs. when the page is compiled and executed (see EXCEPTION). Thanks peops! EXCEPTION Unable to compile class 'try' without 'catch' or 'finally' but I dont have any exception handling in the page. /EXCEPTION CODE % if(action.equals(edit)){ % %@ include file=includes/edit_staff.jsp% % }else{ % %@ include file=includes/view_staff.jsp% % } % /CODE Kyle Burke
RE: Include question...
This was an 'Internal Servlet Error' by the way. Stack trace follows. Thanks. Internal Servlet Error: org.apache.jasper.JasperException: Unable to compile class for JSPD:\tomcat\work\localhost_8080%2Fadmin\_0002faboutus_0002fedit_0005fstaff_ 0002ejspedit_0005fstaff_jsp_25.java:140: 'catch' without 'try'. } catch (Exception ex) { ^ D:\tomcat\work\localhost_8080%2Fadmin\_0002faboutus_0002fedit_0005fstaff_000 2ejspedit_0005fstaff_jsp_25.java:149: 'try' without 'catch' or 'finally'. } ^ D:\tomcat\work\localhost_8080%2Fadmin\_0002faboutus_0002fedit_0005fstaff_000 2ejspedit_0005fstaff_jsp_25.java:149: '}' expected. } ^ 3 errors at org.apache.jasper.compiler.Compiler.compile(Compiler.java:254) at org.apache.jasper.servlet.JspServlet.doLoadJSP(JspServlet.java:462) at org.apache.jasper.servlet.JasperLoader12.loadJSP(JasperLoader12.java:146) at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:433) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspSe rvlet.java:152) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja va:164) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404) at org.apache.tomcat.core.Handler.service(Handler.java:286) at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372) at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79 7) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743) at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC onnectionHandler.java:210) at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416) at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498) at java.lang.Thread.run(Thread.java:484) -Original Message- From: Kyle Burke [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 23, 2001 1:40 PM To: Tomcat-Users Subject: Include question... Is this possible (see CODE)? I have a file that depends on the query string for display. Can I have include files based on that query string too? If action=edit show the data in form fields otherwise show it in formatted text. When the files are included vs. when the page is compiled and executed (see EXCEPTION). Thanks peops! EXCEPTION Unable to compile class 'try' without 'catch' or 'finally' but I dont have any exception handling in the page. /EXCEPTION CODE % if(action.equals(edit)){ % %@ include file=includes/edit_staff.jsp% % }else{ % %@ include file=includes/view_staff.jsp% % } % /CODE Kyle Burke
Re: Include question...
Hello Kyle, you should check the compiled jsp in the work directory. The coplete path and filename should be in the error message. There you will see, that in this .java file there is a try catch arround your code. And, so it often happened to me, there ist something wron with the opening and closing {} brackets If you have a look at this code you will see Sascha