Précédent   Forum des professionnels en informatique > Webmasters - Développement Web > AJAX
AJAX Forum sur la programmation AJAX. Avant de poster : Cours AJAX, FAQ AJAX, Toutes les FAQ JavaScript
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 03/09/2011, 17h31   #1
Invité de passage
 
Homme
Étudiant
Inscription : août 2011
Messages : 5
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : Féroé

Informations professionnelles :
Activité : Étudiant
Secteur : Enseignement

Informations forums :
Inscription : août 2011
Messages : 5
Points : 0
Points : 0
Par défaut jsp et xml et ajax

Salut,
voila mon page charge_galerie.jsp

Code :
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
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="Connect.*"%>
<%@ page import = "java.io.*, java.util.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
 
 
    <title>My JSP 'charge_galerie.jsp' starting page</title>
    <meta http-equiv="content-type" content="text/xml; charset=UTF-8">
	<meta http-equiv="cache-control" content="no-cache,must-revalidate">
	<meta http-equiv="expires" content="Fry ,1 Sep 2011 15:20:31 GMT ">    
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
 
  </head>
 
  <body>
  <%BD base= new BD();
Vector v = base.getAllImage(request.getParameter("ch_img_rubid"));
String xm=new String();
if(v.size()!=0){
xm="<?xml version='1.0' encoding='UTF-8'?>";
xm+="<images>";
for(int i=0;i<v.size();i+=4){
xm+="<image orientation='"+v.get(i+3)+"'>";
xm+="<ch_img_fichier>"+v.get(i+2)+"</ch_img_fichier>";
xm+="<ch_img_id>"+v.get(i)+"</ch_img_id>";
xm+="<ch_img_rubid>"+v.get(i+1)+"</ch_img_rubid>";
xm+="</image>";
}
xm+="</images>";
}
else{xm+="<erreur>Erreur</erreur>";}
%>
<%=xm%>
 
  </body>
</html>
et voila mon page d'acceil qui contient ce script
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function charge_galerie(arg){
var objxhr=xhr_connect()
if(objxhr){
objxhr.onreadystatechange=function(){
  if(objxhr.readyState==4){
     if(objxhr.status==200){alert(objxhr.objxhr.responseXML )                            
 
 
                            }
  }
}
var sql="ch_img_rubid="+arg;
objxhr.open("POST","charge_galerie.jsp",true)
objxhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
objxhr.send(sql);
 
}
else{
     alert("soucie d'xmlHttpRequest")
    }
 
}
le probleme que je n'accepte pas le fichier xml qui déjà créer dans la page charge_galerie.jsp l'instruction suivant alert(objxhr.objxhr.responseXML ) affiche:null
est ce que la creation xml dans la page charge_galerie vrais ou non
merci d'avance
fehdi est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 04/09/2011, 10h38   #2
Expert Confirmé Sénior
 
Avatar de RomainVALERI
 
Homme Romain VALERI
POOête
Inscription : avril 2008
Messages : 2 573
Détails du profil
Informations personnelles :
Nom : Homme Romain VALERI
Âge : 35
Localisation : France, Meurthe et Moselle (Lorraine)

Informations professionnelles :
Activité : POOête

Informations forums :
Inscription : avril 2008
Messages : 2 573
Points : 4 075
Points : 4 075
Citation:
Envoyé par fehdi Voir le message
l'instruction suivant alert(objxhr.objxhr.responseXML ) affiche:null
A moins que ton objet objxhr ait une propriété objxhr (ce qui serait quand même un petit peu n'importe quoi ), je trouve ça tout-à-fait normal... ^^

> essaie plutot objxhr.responseXML tout simplement
> quand tu postes du code, mets le entre balises CODE sinon c'est illisible stp
> ne poste pas de code serveur : poste plutot le code généré (html) récupéré dans un navigateur qui affiche ta page
__________________

...pour les linguistes et les curieux >>> générateur de phrases aléatoires

__________________
RomainVALERI est actuellement connecté   Envoyer un message privé Réponse avec citation 10
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 23h39.


 
 
 
 
Partenaires

Hébergement Web