LIke script is not loaded

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

LIke script is not loaded

redfox26
This post was updated on .
I use spring boot 2 and thymeleaf 3. On one of my page, when user click on a link

 <li th:class="${activeTab=='export'} ? 'active nav-item' : 'nav-item'">
     <a class="nav-link" th:href="@{/menu/exports}" th:text="#{exports}"</a></li>
I get thoses errors

jquery.inputpicker.js:13 Uncaught ReferenceError: require is not defined jquery.dataTables.min.js:5 Uncaught ReferenceError: module is not defined dataTables.bootstrap4.min.js:5 Uncaught ReferenceError: module is not defined dataTables.buttons.min.js:8 Uncaught ReferenceError: module is not defined buttons.print.min.js:5 Uncaught ReferenceError: module is not defined buttons.bootstrap4.min.js:5 Uncaught ReferenceError: module is not defined dataTables.responsive.min.js:5 Uncaught ReferenceError: module is not defined responsive.bootstrap4.min.js:5 Uncaught ReferenceError: module is not defined bootbox.min.js:8 Uncaught ReferenceError: module is not defined

In my script fragment

<div th:fragment="Scripts">

    <script type="text/javascript" th:src="@{/js/jquery-3.3.1.min.js}"></script>
    <script type="text/javascript" th:src="@{/js/jquery.inputpicker.js}"></script>    ...
</div>

I paste my small page here https://pastebin.com/jDwjv218

Seem like thymeleaf have not loaded js library

On my controller page

@GetMapping(value = {"/menu/exports"})
public String getExportsTemplate() {
    return "menu/exports";
}

Strangely, if i remove this line:

 Export

js script is load correctly