jQuery in Action, 2nd edition*
The moose likes IDEs, Version Control and other tools and the fly likes Where to store css and js files in eclipse Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Where to store css and js files in eclipse" Watch "Where to store css and js files in eclipse" New topic

Where to store css and js files in eclipse

P Arunkumar
Ranch Hand

Joined: Jan 05, 2012
Posts: 119

Iam developeing jsp page in eclipse, my project is i wants to show some datas in tree structure, for that i used jquery now its fine but without internet it is not working, by useing some sites it takeing 2 js files and 2css files. now i got the css and js code but i don't know where i want to store the files. and the main thing is i need to mention the path of the css anf js file in my treestructure code. This is my first project so i don't know many things because iam new to developing filed, please guide me. below i have mention my code

<script src="http://code.jquery.com/jquery-latest.js"></script>
<link rel="stylesheet" href="http://jquery.bassistance.de/treeview/demo/screen.css" type="text/css" />
<link rel="stylesheet" href="http://jquery.bassistance.de/treeview/jquery.treeview.css" type="text/css" />
<script type="text/javascript" src="http://jquery.bassistance.de/treeview/jquery.treeview.js"></script>


This is my code for tree structure, please anyone help me to solve my problem.

Thanks in advance.

Thank & Regards,
Jenifer Rajkumar.
Swastik Dey

Joined: Jan 08, 2009
Posts: 1449

It can reside in the same folder where your html/jsp page resides, or it can reside in any sub folder within that too. But accordingly to you have to specify the path.

Karthik Shiraly
Ranch Hand

Joined: Apr 04, 2009
Posts: 489
Deploy them in subdirectories under "[your-project]/WebContent". I usually name the subdirectories "js" and "css".
Then use relative paths like this:

If your web application URL is something like "http://localhost:8080/mywebapp", then a relative path like "css/screen.css" will be treated by browser as "http://localhost:8080/mywebapp/css/screen.css".

On a side note - for future reference - never link to other sites directly like you've done to http://jquery.bassistance.de, unless you have their permission or unless they state that the URL is available for public use.
It's called "hotlinking" - or more pejoratively, "leaching".
It's bad web etiquette, because you're making the owner of that private site serve your users. It'll increase their bandwidth costs, and the load on their servers.

Neeraj Dhiman
Ranch Hand

Joined: Dec 19, 2011
Posts: 63

yes you can store any folder and sub folder where your html/jsp page reside.
if you store in the same folder you can just access it by giving the name.

if you have a sub folder named jsfolder

and if it is in one step back hierarchy

Correct Me if i am wrong
P Arunkumar
Ranch Hand

Joined: Jan 05, 2012
Posts: 119
I have created sub folder and pasted the code but still it is not running.
P Arunkumar
Ranch Hand

Joined: Jan 05, 2012
Posts: 119

Thank You so much, now it is running successfully, thank for Your guide.
I agree. Here's the link: http://aspose.com/file-tools
subject: Where to store css and js files in eclipse
Similar Threads
Directory Structure JSP & JS
jQuery datepicker JSP question
Path to JavaScript or CSS
jquery accordion is causing jquery treeview picker to breakup
Linkking css & js to jsp in struts