0

Relative url to css file href=/rootOnServer/external.css

asked 2008-10-17 14:20:49 +0800

guleri gravatar image guleri
75 2

Hi
I'm just curious how i insert a server-root level external css file..

<?link rel="stylesheet"  type="text/css" href="/rootOnServer/external.css"?>

Adds the application name in front.. like this;

<link rel="stylesheet" type="text/css" href="/contextRoot/rootOnServer/external.css">

...Thanks =)

delete flag offensive retag edit

6 Replies

Sort by ยป oldest newest

answered 2008-10-20 00:35:19 +0800

flyworld gravatar image flyworld
155 3

updated 2008-10-20 01:11:25 +0800

i think you can use tilde
for example :

<link rel="stylesheet" type="text/css" href="~/contextRoot/rootOnServer/external.css">

link publish delete flag offensive edit

answered 2008-10-20 16:45:53 +0800

hkn gravatar image hkn
246 3

hi guleri,

maybe I am wrong or do not understand.

Addressing a resource outside the webapps folder is normally not allowed.
The ROOT "/" normally addresses you application root (for example tomcat environment)

/tomcat/webapps/<your_app>/

That is for security reasons, because else anyone could adresse http://your_open_server/etc/<one of your config files>

/Horst

link publish delete flag offensive edit

answered 2008-10-20 16:48:41 +0800

hkn gravatar image hkn
246 3

the "~" means the users home which in case of tomcat (running as user "tomcat" hopefully) addresses /home/tomcat which normally does not exists.

But as I wrote before, maybe I didn't get your question.

regards

link publish delete flag offensive edit

answered 2008-10-27 11:25:15 +0800

guleri gravatar image guleri
75 2

Hi again :)
Thanks, the tilde ~ was what i was looking for i think.. seems to work at my first test at least.
We have a lot of global resources on web-server-root.. like css images etc. i was not looking for files outside "public" web root on our server.
I must admit i i tried a little workaround first, having managers breathing down my neck..

<h:link type="text/css" href="/css/style.css" rel="stylesheet" />

It did the trick, but I like to work with the framework not around it.

Thanks!

link publish delete flag offensive edit

answered 2008-10-28 11:02:53 +0800

dennis gravatar image dennis
3679 1 6
http://www.javaworld.com....

Attach the web context to a resource that start with "/" is a common approach of J2EE application.

does this works?
<?link rel="stylesheet" type="text/css" href="/../external.css"?>

link publish delete flag offensive edit

answered 2008-10-28 11:36:23 +0800

guleri gravatar image guleri
75 2

dunno. well it is just to test i guess...

But why not use:?
<?link rel="stylesheet" type="text/css" href="~/external.css"?>

Should maybe described it better in my last response.

-Erik

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2008-10-17 14:20:49 +0800

Seen: 623 times

Last updated: Oct 28 '08

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More