[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3616
  • Last Modified:

velocity templates and stylesheets - css files



i'm trying to include a css file within a velocity template but for some reason it's not being picked up

if i put the path of the css file within the <body> tags the file is seen and printed out, can someone tell me where i'm going wrong?

<html>
<head>
        <link rel="stylesheet" type="text/css" href="$stylesheet"/>  ----- not picked up
</head>

<body>
      <td>$stylesheet</td>   --- picked up and displays on the page
</body>

</html>
0
dalecon
Asked:
dalecon
  • 5
  • 4
1 Solution
 
objectsCommented:
so what does the link tag end up as?
0
 
daleconAuthor Commented:


when i view source, it shows the <link tag> like this

<link rel="stylesheet" type="text/css" href="\webapps\projectname\style.css"/>
0
 
objectsCommented:
looks like your stylesheet variable has the wrong value
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
daleconAuthor Commented:


the stylesheet variablehas the correct value, when i nvigate to the href path, the stylesheet is there.

if i put the stylesheet vairable in a td like this <td>$stylesheet</td>, the contents of the css file are printed out


0
 
daleconAuthor Commented:


i mean <td>#parse($stylesheet)</td>
0
 
objectsCommented:
if you're using it in a link tag then it needs to be the path required to download the file, thats not the same as the path to include it server side. use <script> tag if you want to do that

0
 
daleconAuthor Commented:


OK, so if i have a project like this

webapps
  - project1
  file1.jsp
  file2.html
    - WEB-INF
      - classes


where should my stylesheet (css file) go?

I've tried it under project1, i've tried under WEB-INF but it's not being picked up
0
 
objectsCommented:
value of stylesheet should be "\style.css" if its under project 1
0
 
daleconAuthor Commented:


sorted this now - i forgot that it is the browser reading the file, left off half the path to get to the css file




0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now