Announcement Announcement Module
Collapse
No announcement yet.
how use JavaScript library Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • how use JavaScript library

    Hello,

    I created my first Spring roo project and I want to use a javascript library to sort tables (http://www.kryogenix.org/code/browser/sorttable/).

    Where can I put my file.js in my project ? Maybe in "JavaScript ressources" ?

    How can I use it?
    In "webinf/tags/form/fields/table.tagx" I tried to add it by using :
    Code:
    <script src="????/sorttable.js"></script>
    ====

    I also tried to add images in my css file but the url of the image doesn't work...

    Thank's for help !

  • #2
    Hello,

    Try putting your scripts into a "scripts" folder into "src/main/webapp". Then, into table.tagx, you could put that:

    Code:
    <spring:url value="/scripts/sorttable.js" var="sorttable_url"/>
    
    ....
    
    <script src="${sorttable_url}" type="text/javascript"></script>
    I tried that and it worked me fine.

    Comment


    • #3
      In order to define the physical location for the logical "/resources" URL you need to edit the file src/main/webapp/WEB-INF/spring/webmvc-config.xml:

      Code:
      	<!-- Handles HTTP GET requests for /resources/** by efficiently serving 
      		up static resources -->
      	<mvc:resources location="/, /WHATEVERYOUWANT/, classpath:/META-INF/web-resources/" mapping="/resources/**"/>
      See: http://forum.springsource.org/showth...752#post379752

      Comment

      Working...
      X