我的代码是这样的,但他还是只能在jsp中显示xml,不能出现对话框让我下载
                          Element root = new Element("list"); 
   
    Document doc = new Document(root); 
   
    for (int i = 0; i < 5; i++) 
    { 
    
     Element elements = new Element("company"); 
   
     elements.setAttribute("id", "" + i); 
 
     elements.addContent(new Element("company_name").setText("name" + i)); 
     elements.addContent(new Element("company_email").setText("@" + i+ ".aaa")); 
    
     root.addContent(elements); 
     } 
    
     response.setHeader("Content-Disposition ","attachment;filename=test.xml\""); 
     response.setContentType("application/x-msdownload"); 



    XMLOutputter XMLOut = new XMLOutputter(); 
    XMLOut.output(doc, new FileOutputStream("test.xml")); 
   

try 
{
FileInputStream fileInputStream = new FileInputStream("test.xml");
OutputStream o = response.getOutputStream();
int i = 0;
while ((i = fileInputStream.read()) != -1)
o.write(i);

fileInputStream.close();
o.flush();
o.close();

catch (FileNotFoundException e) 
{
e.printStackTrace();

catch (IOException e) 
{
e.printStackTrace();
}