Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 692101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:36:57+00:00 2026-05-14T02:36:57+00:00

How to get the XML translation to HTML dropdownlist with ajax? I send the

  • 0

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 don’t 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");

        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 don’t 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…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T02:36:57+00:00Added an answer on May 14, 2026 at 2:36 am

    To be sure: is that the entire JSP file? The error message namely suggests that you’ve a <!DOCTYPE> in top of it which points to a DTD at w3.org, but that the webbrowser in question can’t load it. The error message also suggests that you’re using IE to test this all, this webbrowser is known to have odd restrictions and quirks with regard to opening XML files from http://localhost. Try a more decent webbrowser instead, for example Firefox.

    Further on I discover several flaws in this approach:

    1. The </body></html> really doesn’t belong there at bottom of the JSP. Remove them.
    2. The JSP is the wrong tool for this job. Make use of a Servlet.
    3. The if (it.hasNext()) piece is superfluous as it’s already handled by the for statement.
    4. The XML should have one root element. Right now you’re writing multiple <wa> elements to it.
    5. The SQL is prone to SQL injection attacks. Make use of named queries.

    Not really a problem, but more a suggestion, I recommend to have a look at jQuery to fire ajaxical requests and do DOM manipulation in a nice, concise and crossbrowsercompatible way.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am calling oracle package, to get xml file from the package into oracleDataReader.
I need to get the xml path opf the xml file by providing the
I'm using cURL to get the XML file for my Twitter friend's timeline. (API
I'm working with XML data from an application where we get XML like this:
I have a few windwos services. They get xml column from Sql server manipulate
I get an XML string from a certain source. I create a DOMDocument object
I am supposed to get some XML data from the server say, <?xml><a></a><?xml><a></a><?xml><a></a><?xml><a></a> Suppose
I am using the following code to get an XML data from a website
im trying to do a ajax port to a php file, and it seems
I've uploaded a ZIP file containing both the XML file I'm trying to read

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.