Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sql-server-2005/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
更改tomcat目录下JAXBXML生成的路径_Tomcat_Jaxb - Fatal编程技术网

更改tomcat目录下JAXBXML生成的路径

更改tomcat目录下JAXBXML生成的路径,tomcat,jaxb,Tomcat,Jaxb,我在tomcat服务器中动态生成一个XML文件,我需要在JSP页面中提供XML文件链接以使其可下载。我使用简单的JAXB生成XML,但XML文件并没有在tomcat目录中生成。请帮忙 private static final String FILE_NAME = "jaxb-test.xml"; JAXBContext context = JAXBContext.newInstance(test.class); Marsh

我在tomcat服务器中动态生成一个XML文件,我需要在JSP页面中提供XML文件链接以使其可下载。我使用简单的JAXB生成XML,但XML文件并没有在tomcat目录中生成。请帮忙

            private static final String FILE_NAME = "jaxb-test.xml";

            JAXBContext context = JAXBContext.newInstance(test.class);
            Marshaller m = context.createMarshaller();

            m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);

            // Write to File
            m.marshal(emp, new File(FILE_NAME));

使用springrest,我通过使用@ResponseBody和http头返回
returnnewhttpentity