title: How do I output the content type text/xml to the browser in Struts 1.3
body: <p>I have an Ajax call in a Struts 1.3 application and I'm having trouble getting it to return valid XML to the browser.  The content of the XML is being sent back correct, however the browser still reconizes the response type as text/html.  </p>
  
  <p>My action class looks like this:</p>
  
  <pre><code> public ActionForward newContractCAUAjax(ActionMapping actionMapping,
          ActionForm actionForm, HttpServletRequest httpServletRequest,
          HttpServletResponse httpServletResponse)throws Exception {
  
      String target="forwardToCAUXML";
  
      DynaActionForm dynaActionForm = (DynaActionForm) actionForm;
  
      httpServletResponse.setContentType("text/xml");
      httpServletResponse.setHeader("Content-type","application/xhtml+xml");
  
      ...
  
      return actionMapping.findForward(target);
  }
  </code></pre>
  
  <p>What I'm currently doing is just grabbing the XML string that the browser sets back and using jQuery's parseXML() method to get valid XML but this seems like a hack and I'd rather have struts send the response back as a valid XML response.  </p>