I find a problem with sending receiving parameter
- by kawtousse
how to get the xml translation to html dropdownlist with ajax.
I send the parameter with GET method but the JSP FILE THAT GENERATES THE XML DONT RECEIVE IT.
var url="responsexml.jsp";
url=url+"?projectCode="+prj.options[prj.selectedIndex].value;
xmlhttp.onreadystatechange=stateChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
and then in responsexml.jsp I do like that:
<%
String projectcode= (String)request.getParameter("projectCode");
System.out.println("++++projectCode:=" +projectcode);
Session s = null;
Transaction tx;
try {
s = HibernateUtil.currentSession();
tx = s.beginTransaction();
Query query = s.createQuery("SELECT from Wa wa where wa.ProjectCode='"+projectcode+"'");
response.setContentType("text/xml");
PrintWriter output = response.getWriter();
output.write( "<?xml version=\"1.0\" encoding=\"utf-8\"?>");
//response.setHeader("Cache-Control", "no-cache");
//constriure le xml
if(projectcode!=null)
{
for(Iterator it=query.iterate();it.hasNext();)
{
if(it.hasNext())
{
Wa object=(Wa)it.next();
//out.print( "<item id=\"" +object.getIdWA() + "\" name=\"" + object.getWAName() + "\" />");
output.write("<wa>");
output.write( "<item id=\"" + object.getIdWA() + "\" name=\"" + object.getWAName() + "\" />");
output.write("</wa>");
} }
}
} catch (HibernateException e) {
e.printStackTrace();
}
%>
</body>
</html>
With this code I dont have my xml file. I got this error:
The server did not understand the request, or the request was invalid. Erreur de traitement de la ressource http://www.w3.o...
PLEASE HELP.