Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Where to store css and js files in eclipse

 
P Arunkumar
Ranch Hand
Posts: 119
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

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

<head>
<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>
<script>
$(document).ready(function()
{
$("#example").treeview();
});

</script>
</head>


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


Thanks in advance.


Thank & Regards,
Jenifer Rajkumar.
 
Swastik Dey
Rancher
Posts: 1603
5
Android Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 1195
25
Android C++ Java Linux PHP Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 68
IBM DB2 Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
e.g

if you have a sub folder named jsfolder


and if it is in one step back hierarchy
then


 
P Arunkumar
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have created sub folder and pasted the code but still it is not running.
 
P Arunkumar
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Thank You so much, now it is running successfully, thank for Your guide.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic