RE: Not getting CSS with XML
Paul, Did you look at the source code for both? Use your browser's view source option for both the static and the jsp docs. Compare them side by side and tell us what you see. Garrett --- Durham David Cntr 805CSS/SCBE [EMAIL PROTECTED] wrote: Is it possible that you made a change to the xml file that is not showing up in the jsp? The include that you are using is a compile time include meaning that if you change the included xml file without changing the including jsp file then those changes will not be reflected. Dave -Original Message- From: Caton, Paul [mailto:[EMAIL PROTECTED]] Sent: Monday, December 02, 2002 3:37 PM To: [EMAIL PROTECTED] Cc: Mah, Carole Subject: Not getting CSS with XML I'd be very grateful for any advice regarding a CSS problem that is puzzling me. Our setup is Tomcat 4.0.6-LE on a Sun running Solaris 8. We have a webapp with the href base set as /acsam. In the acsam webapp directory we have this very simple test CSS stylesheet (mary.css): paragraph { display: block; border: solid red; line-height: 2 } .green {color: green} We also have a simple html file (mary.html): ?xml version=1.0 encoding=UTF-8? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN SYSTEM http://www.w3.o rg/TR/xhtml1/DTD/xhtml1-strict.dtd html head titleCSS Test/title link rel=stylesheet type=text/css href=/acsam/mary.css/ /head body div p class=greenMary had a little lamb./p /div /body /html If we access this file directly (ie. [path]/acsam/mary.html) it displays correctly - the text is green as dictated by the mary.css stylesheet. Similarly, if we access mary.html by using an include statement in a JSP, like this (mary2.jsp): %@ include file=mary.html % it displays correctly as before. Now to the XML. We have a simple XML file (mary.xml): ?xml version='1.0' encoding='UTF-8'? ?xml-stylesheet type=text/css href=/acsam/mary.css? document paragraph Mary had a little lamb. /paragraph /document If we access this file directly (ie. [path]/acsam/mary.xml) it displays correctly, with a red border around the paragraph, as dictated by the mary.css stylesheet. However (here's the puzzling part), when we try to access mary.xml with a very simple JSP file like this (mary.jsp): %@ include file=mary.xml % it does NOT display correctly. For some reason the ?xml-stylesheet? link is not getting the CSS, even though it does get it when we access the XML file directly. As you can see, the path to the CSS file is the same in both mary.html and mary.xml. Can anyone explain why accessing the XML via the JSP doesn't get us the CSS styles? Thanks, Paul. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] = http://dhtmlkitchen.com/ JSP | Servlets | DHTML Garrett Needs A Job __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Not getting CSS with XML
Dave, Thanks for the reply, but no, I'm sure that's not the problem. Bitter experience has taught us to delete all the work/ files and recompile everything when testing changes, so I'm certain that the compiled JSP file is always up to date with the XML file. Paul. -Original Message- From: Durham David Cntr 805CSS/SCBE [mailto:[EMAIL PROTECTED]] Sent: Monday, December 02, 2002 4:44 PM To: Tomcat Users List Subject: RE: Not getting CSS with XML Is it possible that you made a change to the xml file that is not showing up in the jsp? The include that you are using is a compile time include meaning that if you change the included xml file without changing the including jsp file then those changes will not be reflected. Dave -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Not getting CSS with XML
are you setting the content type in the jsp? Charlie -Original Message- From: Caton, Paul [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 03, 2002 9:06 AM To: Tomcat Users List Subject: RE: Not getting CSS with XML Dave, Thanks for the reply, but no, I'm sure that's not the problem. Bitter experience has taught us to delete all the work/ files and recompile everything when testing changes, so I'm certain that the compiled JSP file is always up to date with the XML file. Paul. -Original Message- From: Durham David Cntr 805CSS/SCBE [mailto:[EMAIL PROTECTED]] Sent: Monday, December 02, 2002 4:44 PM To: Tomcat Users List Subject: RE: Not getting CSS with XML Is it possible that you made a change to the xml file that is not showing up in the jsp? The include that you are using is a compile time include meaning that if you change the included xml file without changing the including jsp file then those changes will not be reflected. Dave -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Not getting CSS with XML
Charlie, A colleague suggested I try adding this to the JSP: response.setContentType(text/html;charset=UTF-8) but it made no difference. Is there another way you know of I could try? Paul. -Original Message- From: Cox, Charlie [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 03, 2002 10:06 AM To: 'Tomcat Users List' Subject: RE: Not getting CSS with XML are you setting the content type in the jsp? Charlie -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Not getting CSS with XML
that should work. Make sure you have it *before* your include and before any whitespace in your jsp. Also look in the logs for errors. You may want to use AccessLogValve(to log requests) to see if the css is requested with the wrong path. Charlie -Original Message- From: Caton, Paul [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 03, 2002 11:16 AM To: Tomcat Users List Subject: RE: Not getting CSS with XML Charlie, A colleague suggested I try adding this to the JSP: response.setContentType(text/html;charset=UTF-8) but it made no difference. Is there another way you know of I could try? Paul. -Original Message- From: Cox, Charlie [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 03, 2002 10:06 AM To: 'Tomcat Users List' Subject: RE: Not getting CSS with XML are you setting the content type in the jsp? Charlie -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Not getting CSS with XML
Okay, I put the Java expression first so that now the JSP file looks like this: %= response.setContentType(text/html;charset=UTF-8) %%@ include file=mary.xml % After I recompiled and tried to access the page I got this error message: org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated. An error occurred at line: 1 in the jsp file: /mary.jsp Generated servlet error: /opt/local/jakarta-tomcat-4.0.6-LE-jdk14/work/Standalone/localhost/acsam /mary$jsp.java:54: Incompatible type for method. Can't convert void to java.lang.Object. out.print( response.setContentType(text/html;charset=UTF-8) ); Paul. ** Charlie wrote: Make sure you have it *before* your include and before any whitespace in your jsp. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Not getting CSS with XML
Paul Caton, The error message your getting is because of the fact that response.setContentType() doesn't return anything. You used %= % in your jsp, which needs an Object or a primitive inbewteen those brackets. Your jsp is then going to call toString() on that Object (or just blithely print the primitive) and make that part of your webpage. Since response.setContentType() doesn't return anything, there is no Object to call toString() on, or no primitive to blithely print! Try % % instead. Omit the equals sign. Don't forget to put a semicolon at the end. yours, Julius Davies, Programmer, CUCBC Email: [EMAIL PROTECTED], Ph: 604.730.6385 Code inside %= % should never end with a semicolon. Code inside % % needs semicolons at the end of each line. -Original Message- From: Caton, Paul [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 03, 2002 10:49 AM To: Tomcat Users List Subject: RE: Not getting CSS with XML Okay, I put the Java expression first so that now the JSP file looks like this: %= response.setContentType(text/html;charset=UTF-8) %%@ include file=mary.xml % After I recompiled and tried to access the page I got this error message: org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated. An error occurred at line: 1 in the jsp file: /mary.jsp Generated servlet error: /opt/local/jakarta-tomcat-4.0.6-LE-jdk14/work/Standalone/local host/acsam /mary$jsp.java:54: Incompatible type for method. Can't convert void to java.lang.Object. out.print( response.setContentType(text/html;charset=UTF-8) ); Paul. ** Charlie wrote: Make sure you have it *before* your include and before any whitespace in your jsp. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Not getting CSS with XML
Ah ha! Thanks, Julius - that got rid of the server error. But I'm still back with the lack of CSS. The logs aren't helping either, except negatively. That is, when I access mary2.jsp (which simply includes mary.html)the localhost_access_log shows: Get /acsam/mary2.jsp HTTP 1.1 200 358 Get /acsam/mary2.css HTTP 1.1 200 96 But when I access mary.jsp (which simply includes mary.xml) the log just shows: Get /acsam/mary.jsp HTTP 1.1 200 182 It looks like there's something inside ?Jasper/?Catalina which doesn't know what to do with the ?xml-stylesheet? tag when it gets it via a compiled JSP. I just wish I knew that for sure, and then I could give up trying to use the XML/CSS/JSP combination (although it would be really, really convenient for our project if that combination worked). If anyone else has got this combination to work, please let me know how. Meanwhile, my thanks to people who have been trying to help. Paul. -Original Message- From: Julius Davies [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 03, 2002 2:28 PM To: Tomcat Users List Cc: Caton, Paul Subject: RE: Not getting CSS with XML Paul Caton, The error message your getting is because of the fact that response.setContentType() doesn't return anything. You used %= % in your jsp, which needs an Object or a primitive inbewteen those brackets. Your jsp is then going to call toString() on that Object (or just blithely print the primitive) and make that part of your webpage. Since response.setContentType() doesn't return anything, there is no Object to call toString() on, or no primitive to blithely print! Try % % instead. Omit the equals sign. Don't forget to put a semicolon at the end. yours, Julius Davies, Programmer, CUCBC Email: [EMAIL PROTECTED], Ph: 604.730.6385 Code inside %= % should never end with a semicolon. Code inside % % needs semicolons at the end of each line. -Original Message- From: Caton, Paul [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 03, 2002 10:49 AM To: Tomcat Users List Subject: RE: Not getting CSS with XML Okay, I put the Java expression first so that now the JSP file looks like this: %= response.setContentType(text/html;charset=UTF-8) %%@ include file=mary.xml % After I recompiled and tried to access the page I got this error message: org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated. An error occurred at line: 1 in the jsp file: /mary.jsp Generated servlet error: /opt/local/jakarta-tomcat-4.0.6-LE-jdk14/work/Standalone/local host/acsam /mary$jsp.java:54: Incompatible type for method. Can't convert void to java.lang.Object. out.print( response.setContentType(text/html;charset=UTF-8) ); Paul. ** Charlie wrote: Make sure you have it *before* your include and before any whitespace in your jsp. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Not getting CSS with XML
Actually, I'm confused as to why you'd ever use a scriptlet for setting the content type in a JSP. In addition, the default content type is already text/html, so setting it explicitly seems redundant. The output's actually supposed to be XML, right? How 'bout something like: %@ page contentType=text/xml % %@ include file=mary.xml % Quoting Julius Davies [EMAIL PROTECTED]: Paul Caton, The error message your getting is because of the fact that response.setContentType() doesn't return anything. You used %= % in your jsp, which needs an Object or a primitive inbewteen those brackets. Your jsp is then going to call toString() on that Object (or just blithely print the primitive) and make that part of your webpage. Since response.setContentType() doesn't return anything, there is no Object to call toString() on, or no primitive to blithely print! Try % % instead. Omit the equals sign. Don't forget to put a semicolon at the end. yours, Julius Davies, Programmer, CUCBC Email: [EMAIL PROTECTED], Ph: 604.730.6385 Code inside %= % should never end with a semicolon. Code inside % % needs semicolons at the end of each line. -Original Message- From: Caton, Paul [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 03, 2002 10:49 AM To: Tomcat Users List Subject: RE: Not getting CSS with XML Okay, I put the Java expression first so that now the JSP file looks like this: %= response.setContentType(text/html;charset=UTF-8) %%@ include file=mary.xml % After I recompiled and tried to access the page I got this error message: org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated. An error occurred at line: 1 in the jsp file: /mary.jsp Generated servlet error: /opt/local/jakarta-tomcat-4.0.6-LE-jdk14/work/Standalone/local host/acsam /mary$jsp.java:54: Incompatible type for method. Can't convert void to java.lang.Object. out.print( response.setContentType(text/html;charset=UTF-8) ); Paul. ** Charlie wrote: Make sure you have it *before* your include and before any whitespace in your jsp. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Not getting CSS with XML
That did the trick! Thanks, Kris. Paul. -Original Message- From: Kris Schneider [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 03, 2002 3:04 PM To: Tomcat Users List Subject: RE: Not getting CSS with XML ... How 'bout something like: %@ page contentType=text/xml % %@ include file=mary.xml % -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Not getting CSS with XML
Sweet. Glad it worked. Quoting Caton, Paul [EMAIL PROTECTED]: That did the trick! Thanks, Kris. Paul. -Original Message- From: Kris Schneider [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 03, 2002 3:04 PM To: Tomcat Users List Subject: RE: Not getting CSS with XML ... How 'bout something like: %@ page contentType=text/xml % %@ include file=mary.xml % -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Not getting CSS with XML
Is it possible that you made a change to the xml file that is not showing up in the jsp? The include that you are using is a compile time include meaning that if you change the included xml file without changing the including jsp file then those changes will not be reflected. Dave -Original Message- From: Caton, Paul [mailto:[EMAIL PROTECTED]] Sent: Monday, December 02, 2002 3:37 PM To: [EMAIL PROTECTED] Cc: Mah, Carole Subject: Not getting CSS with XML I'd be very grateful for any advice regarding a CSS problem that is puzzling me. Our setup is Tomcat 4.0.6-LE on a Sun running Solaris 8. We have a webapp with the href base set as /acsam. In the acsam webapp directory we have this very simple test CSS stylesheet (mary.css): paragraph { display: block; border: solid red; line-height: 2 } .green {color: green} We also have a simple html file (mary.html): ?xml version=1.0 encoding=UTF-8? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN SYSTEM http://www.w3.o rg/TR/xhtml1/DTD/xhtml1-strict.dtd html head titleCSS Test/title link rel=stylesheet type=text/css href=/acsam/mary.css/ /head body div p class=greenMary had a little lamb./p /div /body /html If we access this file directly (ie. [path]/acsam/mary.html) it displays correctly - the text is green as dictated by the mary.css stylesheet. Similarly, if we access mary.html by using an include statement in a JSP, like this (mary2.jsp): %@ include file=mary.html % it displays correctly as before. Now to the XML. We have a simple XML file (mary.xml): ?xml version='1.0' encoding='UTF-8'? ?xml-stylesheet type=text/css href=/acsam/mary.css? document paragraph Mary had a little lamb. /paragraph /document If we access this file directly (ie. [path]/acsam/mary.xml) it displays correctly, with a red border around the paragraph, as dictated by the mary.css stylesheet. However (here's the puzzling part), when we try to access mary.xml with a very simple JSP file like this (mary.jsp): %@ include file=mary.xml % it does NOT display correctly. For some reason the ?xml-stylesheet? link is not getting the CSS, even though it does get it when we access the XML file directly. As you can see, the path to the CSS file is the same in both mary.html and mary.xml. Can anyone explain why accessing the XML via the JSP doesn't get us the CSS styles? Thanks, Paul. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]