• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

CSS LInks issue

 
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys,

I have a small issue with a linking my CSS / JavaScript / Jsp files. Initially in my projects all the files are kept outside the Web Content (in WebSphere), however to make thing organized I placed all the files inside the Jsp folder. Web content will have the following folder CSS, JSp, JS.

So I referred all the CSS/JS files in my JSP as below, however I am not getting the CSS/JS loaded to my page.

<link rel='STYLESHEET' type='text/css' href='../css/ihon.css'>


if I change the code like this then things are working fine. I really appreciate if any can give me detail explanation how the files will referred in the webcontent.The Same code we used for another project however their it works file with out any issues.



<LINK href="css/Master.css" rel="stylesheet" type="text/css">
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
With Java web apps, the best way to create links is to make them relative to the root of the web application.

To do so read the contextPath from the request object.

Examples:

JSP.1.2:



JSP.2.0:


If you build them this way, it won't matter where you move your JSP or what mapping you're using.
 
reply
    Bookmark Topic Watch Topic
  • New Topic