sortable.js在JSP页面中不起作用
sortable.js not working in JSP pages
我正在尝试使用我在这里找到的这个小脚本,但由于某种原因它不工作,我不知道为什么。
My head tags in browser .jsp:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Parcourir les livres</title>
<script type="text/javascript" src="../../JS/sortable.js"></script>
</head>
我的表,当然在同一页:
<table class="sortable" id="sortabletable">
<thead>
<th>Aperçu</th>
<th>Titre</th>
<th>Éditeur</th>
<th>Auteur</th>
<th>Prix</th>
</thead>
<%
for(Livre livre : livres){
%>
<tr>
<td>Image</td>
<td><% out.println(livre.getNom()); %></td>
<td><% out.println(livre.getEditeur()); %></td>
<td><% out.println(livre.getAuteur()); %></td>
<td><% out.println(livre.getPrix()); %></td>
</tr>
<% } %>
</table>
我不认为它来自src路径,因为我试图将。js放在与我的页面相同的目录中。总之,这是我的树
谢谢
可能你的javascript路径是错误的。在不了解您的应用程序的情况下,我无法给您确切的路径。
可能是JS/sortable.js
或../JS/sortable.js
。不能直接访问WEB-INF目录中的文件。所以你不需要从你的项目结构中找出路径。你必须在运行时从路径中找出它。
您也可以尝试使用绝对路径。
<script type="text/javascript" src="<%=request.getContextPath()%>/JS/sortable.js" />
相关文章:
- Javascript函数在jsp文件中不起作用
- 使用jQuery在jsp中分页不起作用
- 来自JSP的字符串在JavaScript上不起作用
- JSP if() 语句中的 HTML 不起作用
- JSP-Javascript-JSP 登录流程不起作用
- 简单的脚本在 jsp 页面中不起作用
- 使用 href=“#” JQuery 工作,但使用 href=“page.jsp” 不起作用
- jsp Ajax 不起作用
- 当表单操作使用Apache Shiro转到jsp页面时,onClick不起作用
- 函数在 JSP 页面中不起作用
- JQuery 在带有 Struts2 的 JSP 中不起作用
- window.open()在JSP中传递变量时不起作用
- 警报框在jsp中不起作用
- 为什么我的javascript在jsp页面中不起作用
- 为什么我的jsp代码中的搜索按钮不起作用
- JSP:Insert不起作用(SQLSERVER)
- JSP将带有XML字符的String属性传递给JavaScript函数不起作用
- sortable.js在JSP页面中不起作用
- ajax和JSP的表单验证不起作用
- 设置jsp上的Ajax响应不起作用