Re: css and images (stupid question?)
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Terence et al; and at first thanks for the many hints regarding this issue. Terence M. Bandoian schrieb: > My understanding is that relative URLs in CSS style sheets are relative > to the location of the style sheet, not the HTML page which references > the style sheet. Yeah, indeed. I finally solved my problems by referencing to the css within my jsps using the absolute server path, and now everything works the way it's supposed to. Thanks guys! :) Cheers, Kris - -- Kristian Rink * http://zimmer428.net * jab: [EMAIL PROTECTED] icq: 48874445 * fon: ++49 176 2447 2771 "Be yourself the kind of change you want to see in this world." (Gandhi) -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.2 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFDjAAAcxBAPOA1m6wRAo/FAJ4rbXr3c1BmJTK+Lf8mK8xQQuujDwCfUncH hVp1o/q0DjeCoqMCFT7Qp3E= =2WXq -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
css and images (stupid question?)
Hi- My understanding is that relative URLs in CSS style sheets are relative to the location of the style sheet, not the HTML page which references the style sheet. -Terence M. Bandoian > Hi all; > > playing around with tomcat in order to both learn using the package and > create a small web site there, I'm currently left with a problem which, > though probably being small (and not really related to tomcat), keeps > bugging me: > > I'm trying to do the visual stuff of my jsp using a css style file, > which is good, so far. Within the css file, I'm using images for > backgrounds etc like that: > > > background: #fff url(/images/bg_header_blau.jpg) no-repeat top left; > > > My problem, right now, is where to put the images within the web > application so they're actually found when displaying the page. > Initially, I created a folder "images" within my web application and > referred to the images using url(images/...) with relative path names, > which didn't work. Also tried to place the images folder inside > $CATALINA_HOME/webapps and then using absolute image urls (/image/...), > which also didn't work. > > So, where's the magic? I've always been through some tougher moments > with css and images while dynamically generating content, but right now > I feel really helpless about that. Can someone enlighten me? > > Cheers and thanks, > Kris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: css and images (stupid question?)
Kristian Rink wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi all; playing around with tomcat in order to both learn using the package and create a small web site there, I'm currently left with a problem which, though probably being small (and not really related to tomcat), keeps bugging me: I'm trying to do the visual stuff of my jsp using a css style file, which is good, so far. Within the css file, I'm using images for backgrounds etc like that: background: #fff url(/images/bg_header_blau.jpg) no-repeat top left; My problem, right now, is where to put the images within the web application so they're actually found when displaying the page. Initially, I created a folder "images" within my web application and referred to the images using url(images/...) with relative path names, which didn't work. Also tried to place the images folder inside $CATALINA_HOME/webapps and then using absolute image urls (/image/...), which also didn't work. So, where's the magic? I've always been through some tougher moments with css and images while dynamically generating content, but right now I feel really helpless about that. Can someone enlighten me? Well, your basic problem is that relative paths will not work, since pages can be in different directories. Absolute path has one problem, your application can be deployed under different paths. That problem is easy to solve, HttpServletRequest.getContextPath() will give you the deployment path. Just paste it on your desired CSS location, like this: css.jsp --- ... background: #fff url(<%= request.getContextPath() %>/images/bg_header_blau.jpg) no-repeat top left; or, if you're using JSP 2.0 background: #fff url(${request.contextPath}/images/bg_header_blau.jpg) no-repeat top left; ... --- Nix. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: css and images (stupid question?)
Oh you can use aliases too if fronted with an apache web server -Original Message- From: Allistair Crossley [mailto:[EMAIL PROTECTED] Sent: 28 November 2005 12:33 To: Tomcat Users List Subject: RE: css and images (stupid question?) Your URLs if absolute would need to contain the web application name unless your web appliation was the ROOT web application (the only one that runs at /). Therefore if you webapp was called apple and was in webapps/apple, your image refs would need to be /apple/images/ You can use relative image URLs in your CSS OK "BUT" if you are linking to a CSS sheet, again youd need the href to point to /apple/css/mycss.css. Other than that, you can define your CSS styles in the of your pages and then use relative refs to your images, e.e ../images/ Allistair -Original Message- From: Kristian Rink [mailto:[EMAIL PROTECTED] Sent: 28 November 2005 12:28 To: Tomcat Users List Subject: css and images (stupid question?) --- QAS Ltd. Registered in England: No 2582055 Registered in Australia: No 082 851 474 --- Disclaimer: The information contained within this e-mail is confidential and may be privileged. This email is intended solely for the named recipient only; if you are not authorised you must not disclose, copy, distribute, or retain this message or any part of it. If you have received this message in error please contact the sender at once so that we may take the appropriate action and avoid troubling you further. Any views expressed in this message are those of the individual sender. QAS Limited has the right lawfully to record, monitor and inspect messages between its employees and any third party. Your messages shall be subject to such lawful supervision as QAS Limited deems to be necessary in order to protect its information, its interests and its reputation. Whilst all efforts are made to safeguard Inbound and Outbound emails, QAS Limited cannot guarantee that attachments are virus free or compatible with your systems and does not accept any liability in respect of viruses or computer problems experienced. -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi all; playing around with tomcat in order to both learn using the package and create a small web site there, I'm currently left with a problem which, though probably being small (and not really related to tomcat), keeps bugging me: I'm trying to do the visual stuff of my jsp using a css style file, which is good, so far. Within the css file, I'm using images for backgrounds etc like that: background: #fff url(/images/bg_header_blau.jpg) no-repeat top left; My problem, right now, is where to put the images within the web application so they're actually found when displaying the page. Initially, I created a folder "images" within my web application and referred to the images using url(images/...) with relative path names, which didn't work. Also tried to place the images folder inside $CATALINA_HOME/webapps and then using absolute image urls (/image/...), which also didn't work. So, where's the magic? I've always been through some tougher moments with css and images while dynamically generating content, but right now I feel really helpless about that. Can someone enlighten me? Cheers and thanks, Kris - -- Kristian Rink * http://zimmer428.net * jab: [EMAIL PROTECTED] icq: 48874445 * fon: ++49 176 2447 2771 "Be yourself the kind of change you want to see in this world." (Gandhi) -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.2 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFDive4cxBAPOA1m6wRAnRxAJ90PaDKZsQQDo3M4CCd7WV5Syi/MgCdGhbs hobJ1TqkErAqjLxZc6gV0kM= =O7hF -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- QAS Ltd. Registered in England: No 2582055 Registered in Australia: No 082 851 474 --- Disclaimer: The information contained within this e-mail is confidential and may be privileged. This email is intended solely for the named recipient only; if you are not authorised you must not disclose, copy, distribute, or retain this message or any part of it. If you have received this message in error please contact the sender at once so that we may take the appropriate action and avoid troubling you further. Any views expressed in this message are those of the individual sender. QAS Limited has the right lawfully to record, monitor and inspect messages between its employees and any third party. Your messages shall be subject to such lawful supervision as QAS Limited deems to be necessary in order to protect its in
RE: css and images (stupid question?)
Your URLs if absolute would need to contain the web application name unless your web appliation was the ROOT web application (the only one that runs at /). Therefore if you webapp was called apple and was in webapps/apple, your image refs would need to be /apple/images/ You can use relative image URLs in your CSS OK "BUT" if you are linking to a CSS sheet, again youd need the href to point to /apple/css/mycss.css. Other than that, you can define your CSS styles in the of your pages and then use relative refs to your images, e.e ../images/ Allistair -Original Message- From: Kristian Rink [mailto:[EMAIL PROTECTED] Sent: 28 November 2005 12:28 To: Tomcat Users List Subject: css and images (stupid question?) --- QAS Ltd. Registered in England: No 2582055 Registered in Australia: No 082 851 474 --- Disclaimer: The information contained within this e-mail is confidential and may be privileged. This email is intended solely for the named recipient only; if you are not authorised you must not disclose, copy, distribute, or retain this message or any part of it. If you have received this message in error please contact the sender at once so that we may take the appropriate action and avoid troubling you further. Any views expressed in this message are those of the individual sender. QAS Limited has the right lawfully to record, monitor and inspect messages between its employees and any third party. Your messages shall be subject to such lawful supervision as QAS Limited deems to be necessary in order to protect its information, its interests and its reputation. Whilst all efforts are made to safeguard Inbound and Outbound emails, QAS Limited cannot guarantee that attachments are virus free or compatible with your systems and does not accept any liability in respect of viruses or computer problems experienced. -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi all; playing around with tomcat in order to both learn using the package and create a small web site there, I'm currently left with a problem which, though probably being small (and not really related to tomcat), keeps bugging me: I'm trying to do the visual stuff of my jsp using a css style file, which is good, so far. Within the css file, I'm using images for backgrounds etc like that: background: #fff url(/images/bg_header_blau.jpg) no-repeat top left; My problem, right now, is where to put the images within the web application so they're actually found when displaying the page. Initially, I created a folder "images" within my web application and referred to the images using url(images/...) with relative path names, which didn't work. Also tried to place the images folder inside $CATALINA_HOME/webapps and then using absolute image urls (/image/...), which also didn't work. So, where's the magic? I've always been through some tougher moments with css and images while dynamically generating content, but right now I feel really helpless about that. Can someone enlighten me? Cheers and thanks, Kris - -- Kristian Rink * http://zimmer428.net * jab: [EMAIL PROTECTED] icq: 48874445 * fon: ++49 176 2447 2771 "Be yourself the kind of change you want to see in this world." (Gandhi) -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.2 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFDive4cxBAPOA1m6wRAnRxAJ90PaDKZsQQDo3M4CCd7WV5Syi/MgCdGhbs hobJ1TqkErAqjLxZc6gV0kM= =O7hF -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- QAS Ltd. Registered in England: No 2582055 Registered in Australia: No 082 851 474 --- Disclaimer: The information contained within this e-mail is confidential and may be privileged. This email is intended solely for the named recipient only; if you are not authorised you must not disclose, copy, distribute, or retain this message or any part of it. If you have received this message in error please contact the sender at once so that we may take the appropriate action and avoid troubling you further. Any views expressed in this message are those of the individual sender. QAS Limited has the right lawfully to record, monitor and inspect messages between its employees and any third party. Your messages shall be subject to such lawful supervision as QAS Limited deems to be necessary in order to protect its information, its interests and its reputation. Whilst all efforts are made to safeguard Inbound and Outbound emails, QAS Limited cannot guarantee that attachments are virus free or compatible with your systems and doe
css and images (stupid question?)
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi all; playing around with tomcat in order to both learn using the package and create a small web site there, I'm currently left with a problem which, though probably being small (and not really related to tomcat), keeps bugging me: I'm trying to do the visual stuff of my jsp using a css style file, which is good, so far. Within the css file, I'm using images for backgrounds etc like that: background: #fff url(/images/bg_header_blau.jpg) no-repeat top left; My problem, right now, is where to put the images within the web application so they're actually found when displaying the page. Initially, I created a folder "images" within my web application and referred to the images using url(images/...) with relative path names, which didn't work. Also tried to place the images folder inside $CATALINA_HOME/webapps and then using absolute image urls (/image/...), which also didn't work. So, where's the magic? I've always been through some tougher moments with css and images while dynamically generating content, but right now I feel really helpless about that. Can someone enlighten me? Cheers and thanks, Kris - -- Kristian Rink * http://zimmer428.net * jab: [EMAIL PROTECTED] icq: 48874445 * fon: ++49 176 2447 2771 "Be yourself the kind of change you want to see in this world." (Gandhi) -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.2 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFDive4cxBAPOA1m6wRAnRxAJ90PaDKZsQQDo3M4CCd7WV5Syi/MgCdGhbs hobJ1TqkErAqjLxZc6gV0kM= =O7hF -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]