Project

General

Profile

where should I place a *.css file in order for useStyleSheet(...) to see it ?

Added by MICHALIS PAPACHRISTOFOROU about 13 years ago

I'm trying to apply styles using a CSS file

when I use useStyleSheet() I get nothing back

e.g. : * useStyleSheet("mystyles.css");*

where should my CSS file be in order for useStyleSheet() to see it?

My web.xml is as follows:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">





AppMain

Display Name

Description

Application.AppMain





AppMain

url-pattern>/*



Replies (2)

RE: where should I place a *.css file in order for useStyleSheet(...) to see it ? - Added by Thim Anneessens about 13 years ago

Well I think I spot an error in the url-pattern block (rigth after there is a star. It should be

/*

and not

/*

Your url-pattern indicates the path component to your application from the WebRoot. So with a URL pattern /* you will not be able to access any css in the web root because every path is redirected to your app.

What you should do is put a urlpattern /something/* or something/* (depending on the App Container).

When that is done you can simply put the css in the web root and access it with your code.

Look at some of the exemples there very helpfull for that sort of stuff.

Thim.

RE: where should I place a *.css file in order for useStyleSheet(...) to see it ? - Added by MICHALIS PAPACHRISTOFOROU about 13 years ago

Hi Thim,

Sorry for being late on this response.

Actually the above issue was one of those late 2:00 in the night, having a problem with an obvious solution but too sleepy to figure it out, kind of DuM-dUm situation... :P

I solved it next thing in the morning when I opened my web.xml and started laughing.

Basically I gave my application a /app/* pattern and /* for the rest.

For anyone that wants a sample of a web.xml (used in Eclipse's Dynamic web project) here's mine:

<?xml version="1.0" encoding="UTF-8"?>





jwt_take02

app.AppMain





jwt_take02

/app/*





index.html


I allso have a zip of the whole project attached.

    (1-2/2)