merci pour la reponse
un code java par exp un fichier jsp du type ?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| <%@page import="java.io.FileWriter"%>
<%@page import="java.io.File"%>
<%@page import="java.io.IOException"%>
<%
String filename = "compte.json";
String path = getServletContext().getRealPath("/");
try{
FileWriter fw = new FileWriter(path+filename);
String input = request.getParameterNames().nextElement().toString();
fw.write(input);
fw.close();
}
catch(IOException e)
{
System.out.println(e.getMessage());
}
%> |
jai testé ,et ca me dit que lobjet est bien enregistré:
mais quand je passe a l'authentification :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| function authentification()
{
//cree un objet store avec le contenu du json
var authStore = new dojo.data.ItemFileReadStore({
jsId:'store1',
//data: {items: [
// {login:'ut1', mdp:'Alex'},
// {login:'ut2', mdp:'country'}
// ]}
//ou
url:'compte.json'
});
//permet de lire le contenu du store
authStore.fetch({
//requete ou l'on va ajouter les valeurs saisies dans les champs
query: {
user:dojo.byId('login').value, //champ login
pwd:dojo.byId('mdp').value}, //champ mdp
//a la fin de la recherche
onComplete: function (items,request){
//on scanne le resultat contenu dans items
for (i = 0; i < items.length; i++) {
var item1 = items[i];
alert(authStore.getValue(item1,"user"));
}
//si rien n'est trouve
if(i==0){
alert("mauvais login / mot de passe");
}
else{
//document.getElementById("h1").style.display = "block";
//document.getElementById("grid").style.display = "table-cell";
//document.getElementById("h3").style.display = "block";
//document.getElementById("a").style.display = "none";
//document.getElementById("dec").style.display = "block";
document.getElementById("authentif").style.display = "none";
document.getElementById("dec").style.display = "block";
document.getElementById("authentif1").style.display = "none";
document.getElementById("dec1").style.display = "block";
document.getElementById("opajout").style.display = "block";
document.getElementById("img").style.display = "block";
document.getElementById("id_test").style.display = "block";
dojo.byId('login').value="";
dojo.byId('mdp').value="";
} |
il me sort cette erreur !
this._arrayOfTopLevelItems is undefined
jsuis coincé sur cela ,j'espere connaitre lerreur !!
Partager