File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes How to return an xml document instead of jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to return an xml document instead of jsp" Watch "How to return an xml document instead of jsp" New topic
Author

How to return an xml document instead of jsp

Pete Neu
Ranch Hand

Joined: Feb 18, 2005
Posts: 86
Hello,

I would like the Action to return an xml document instead of jsp/html page.
In a normal servlet that's done like that

response.setContentType(CONTENT_TYPE);
PrintWriter out = response.getWriter();
StreamResult streamResult = new StreamResult(out);
.
.
and so on ...

What do I have do to make it happen in Struts?
If that does not work would it make sense to store the xml file on the filesystem and to provide a download?

cheers
Pete
Nimchi Yung
Ranch Hand

Joined: Jan 27, 2004
Posts: 71
Something like this in your Action class:


--Nimchi
 
 
subject: How to return an xml document instead of jsp