Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

about accesing js function in JSP  RSS feed

 
RavindraJpatil patil
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,
i have query regarding including js funtion in jsp. the problem is i have one jsp say
main.jsp , i am including another jsp
say include1.jsp , in this include1.jsp i am calling js funtion

<script language="javascript" src="scripts/jsFuntion.js"></script>

the directory sructure is as follows



so probelm is when i includes include1.sjp the js funtion is not getting called

it takes its path as folder2/scripts/ instead of folder1/scripts

any idea about this

thanks in advance

[BPSouther: Added code tags make directory structure display properly]
[ May 08, 2008: Message edited by: Ben Souther ]
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, all paths in the HTML page are relative to the top-most JSP page that generated it. I'd keep JavaScript files in their own directory, and not tied to any of the JSP pages. That way you can include them from all JSP pages, regardless of where they are.
 
RavindraJpatil patil
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ulf Dittmer:
Yes, all paths in the HTML page are relative to the top-most JSP page that generated it. I'd keep JavaScript files in their own directory, and not tied to any of the JSP pages. That way you can include them from all JSP pages, regardless of where they are.




i dont have access to change the directory structure ..
tell me i want to give whole path then how to give that from root directory
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This may help: http://faq.javaranch.com/java/ResourceUrlProblems, as may this: http://faq.javaranch.com/java/RelativeLinks
[ May 08, 2008: Message edited by: Ulf Dittmer ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!