changing from html to jsp : referenceerror d3 is not defined -


i have html file in draw svgs using dc.js , d3.js .. moment change extension jsp. starts throwing :

uncaught referenceerror: d3 not defined in dc.js

no clues why :( .. suggestions ?

this how inclusing js in html/jsp

<script type="text/javascript" src="../javascripts/jquery.js"></script> <script type="text/javascript" src="../javascripts/d3.js"></script> <script type="text/javascript" src="../javascripts/crossfilter.js"></script> <script type="text/javascript" src="../javascripts/dc.js"></script> 

see thing when use html then, @ time, html page directly accessing recourse. in case of jsp, it's mvc architecture jsp cannot directly access recourse. have provide path of file using jsp tags. following gives example of how can it. suppose created file structure under myproject -> webapp : res -> mytheme -> js -> filename.js following :

1) include following lines in servlet-config.xml

<mvc:resources mapping="/res/**" location="/res/mytheme/" /> <mvc:annotation-driven /> 

it tells framework whenever encounter /res/ replace res/mytheme/ & thats file present.

2) in jsp file, use following line:

<script type="text/javascript" src="<c:url value="/res/js/filename.js"/>"></script> 

hope helpful. it worked me.


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -