我申請這個tutorial在我的項目中做自動完成,所以一切都沒事的時候我把自動完成在一個頁面,但我想把相同的代碼放在另一個頁面,它不工作。我的兩個頁面中的輸入文件具有相同的「id」名稱,並且在第一頁中包含了我的第二頁中的所有必需文件。哪裏不對 ?謝謝。Spring MVC自動完成工作只是在eclipse項目的一個頁面
這是我的第二頁的代碼:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page
import="org.springframework.security.core.context.SecurityContextHolder"%>
<%@ page
import="org.springframework.security.core.userdetails.UserDetails"%>
<%@ page import="org.springframework.security.core.GrantedAuthority"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix='security'
uri='http://www.springframework.org/security/tags'%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Gestion des Fiches de service</title>
<link rel="stylesheet"
href="${pageContext.request.contextPath}/css/style.css" type="text/css" />
<link rel="stylesheet"
href="${pageContext.request.contextPath}/css/TabCookie.css"
type="text/css" />
<script type="text/javascript"
src="${pageContext.request.contextPath}/js/jquery-ui.js"></script>
<script src="${pageContext.request.contextPath}/js/jquery-1.9.1.min.js"></script>
<script src="${pageContext.request.contextPath}/js/functions.js"></script>
<link rel="stylesheet" type="text/css"
href="${pageContext.request.contextPath}/css/jquery-ui.css" />
<link rel="stylesheet" type="text/css"
href="${pageContext.request.contextPath}/css/tcal.css" />
<script type="text/javascript"
src="${pageContext.request.contextPath}/js/tcal.js"></script>
<script
src="${pageContext.request.contextPath}/js/jquery.easytabs.min.js"></script>
<script src="${pageContext.request.contextPath}/js/jquery.easytabs.js"></script>
<script
src="${pageContext.request.contextPath}/js/jquery.hashchange.min.js"></script>
<script type="text/javascript">
function split(val) {
return val.split(/,\s*/);
}
function extractLast(term) {
return split(term).pop();
}
$(document).ready(function() {
$('#tab-container').easytabs();
$("#nom").autocomplete({
source : '${pageContext.request.contextPath}/get_names'
});
$("#cin").autocomplete({
source : '${pageContext.request.contextPath}/get_cin'
});
$("#technologies").autocomplete({
source : function(request, response) {
$.getJSON("${pageContext. request. contextPath}/get_nam", {
term : extractLast(request.term)
}, response);
},
search : function() {
// custom minLength
var term = extractLast(this.value);
if (term.length < 1) {
return false;
}
},
focus : function() {
// prevent value inserted on focus
return false;
},
select : function(event, ui) {
var terms = split(this.value);
// remove the current input
terms.pop();
// add the selected item
terms.push(ui.item.value);
// add placeholder to get the comma-and-space at the end
terms.push("");
this.value = terms.join(", ");
return false;
}
});
});
</script>
</head>
<body>
<div id="look">
<form:form method="get"
action="${pageContext.request.contextPath}/#"
modelAttribute="ag">
<table id="tabmenu" class="test">
<tr>
<td><input type="radio" name="choice" id="np"
onClick="Affichenp();" />Nom et Prenom :</td>
<td><input type="text" name="nom" id="nom"
class="round default-width-input" /></td>
<td><input
class="button round blue image-right ic-right-arrow"
type="submit" value="" id="nombut"></td>
</tr>
</table>
</form:form>
<form:form method="get"
action="${pageContext.request.contextPath}/#"
modelAttribute="ag">
<table id="tabmenu" class="test">
<tr>
<td><input type="radio" name="choice" id="ns"
onClick="Affichecin();" />CIN :</td>
<td><input type="text" name="cin" id="cin"
class="round default-width-input" /></td>
<td><input
class="button round blue image-right ic-right-arrow"
type="submit" value="" id="cinbut"></td>
</tr>
</table>
</form:form>
<form:form method="get"
action="${pageContext.request.contextPath}/#"
modelAttribute="ag">
<table id="tabmenu" class="test">
<tr>
<td><input type="radio" name="choice" id="ns"
onClick="Afficheppr();" />Numéro de somme :</td>
<td><input type="text" name="ppr" id="ppr"
class="round default-width-input" /></td>
<td><input
class="button round blue image-right ic-right-arrow"
type="submit" value="" id="pprbut"></td>
</tr>
</table>
</form:form>
</div>
</body>
</html>
的只有一件事,在素文字工作我只有這一個腳本,但在第二頁,我有兩個劇本的第一頁:jQuery的標籤和自動完成
你可以發佈你的第二個頁面的代碼?你如何包括所有必要的文件? –
我編輯了我的問題,並把第二頁的代碼。 – Somar