Quantcast
Channel: BlogsOfRaghs » html
Viewing all articles
Browse latest Browse all 2

referring the css files for webpages inside Netbeans IDE

$
0
0

If you are dealing with CSS (Cascading Style Sheet) files for the web pages inside Netbeans IDE, you need to know one thing.

It does not pick up the .css files as referred in the files which has the link to it. Generally, all other IDEs and Application Servers should work that way. But when i had been doing a J2EE based web application, i found that aspect missing. When i tested, the pages were displayed as if the css files were not present at all.

Though i tried by placing the css file in a different location  by thinking that whethere the relative path given by me would have got some mistakes, there was no luck still. Then i got a doubt and referred the Help section of the IDE itself. You got to do a different work around for your css files to have effect.

Actually, the Netbeans IDE places (keeps its own references to) the css files in a separate location which is totally far away from your application’s root folder. You have to get that location and put it in the files whichever need the css links (in case of .html, .jsp files).

Steps to do that:

1. Select the particular .css file and Right click on it.

2. Click on either the ‘Copy XML Style’ or ‘Copy HTML Style’ based on the file types where you gonna link this .css file.It will copy the location of this .css file from the Netbean’s perspective into the Clipboard.

3. Now paste the copied text (actual reference to the .css file) in the appropriate place of the files needing this .css file.

In case of .html file, it would be in the ‘href’ attribute of ‘<link>’ element placed inside the ‘<head>’ element. In case of .xml files, place the reference after the XML prologue or header.

Really don’t know whether its purely based on the Netbeans IDE or the internally built-in Tomcat has some contribution towards this! Is this a bug in Netbeans? Yet to find out that :)

But somehow found this to get the css effects on pages with an overhead towards portability! If at all, i need to take the .war file and place it normal Tomcat itself, i may need to change the reference to the .css files referred everywhere right. Just to avoid that , i have made one common .jsp file where i have put this .css reference in <link> element and included this .jsp file in all the other .jsp files through include directive!



Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images