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 Return XML Response from Action Class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Return XML Response from Action Class" Watch "Return XML Response from Action Class" New topic
Author

Return XML Response from Action Class

Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Hi Ranchers,
I am building a web apps, where user need to hit URL which in turn calls an Action class . NOw this action class generate an XML file which i want to Dispaly to user as a response.

How should i do that ??
Any help,

Thanks in advance !


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Praveen Sangolli
Greenhorn

Joined: May 22, 2008
Posts: 28
Hi Sagar
You can do it this way, first of all return null from your action class and then get hold of the PrintWriter, and stuff the xml into it
for eg,

PrintWriter outres = response.getWriter();

outres.print("<response>Success</response>");
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Thats a great help Praveen ...

Thanks a lot !!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Return XML Response from Action Class
 
Similar Threads
2 doubts in AJAX
Ajax and ActionClass
How to get SOAP response as XML in Client Struts or Servlet. ?
Ajax: how to achieve
submit button