struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Neff <>
Subject Re: return ajax text or xml
Date Thu, 21 Aug 2008 18:41:52 GMT
cpanon wrote:
> Hello
> What is the best way to return simple text/html or an xml document from an action?  Do
I have to forward to a servlet and open an output stream and write the stream?  Is there a
simpler/better way?  tia.

I'm not sure what your asking but just recently I have added a property 
in my action which returns an HTML Table.  All I had to do was add the 
escape property to my s:property tag like this:

<s:property escape="false" value="myTable" />

For another project I found that when I tried to write to the output 
stream the execute() method must return null.  Otherwise I would get an 
error indicating the stream was closed when the Action was still trying 
to write to it.

Thirdly, I think there is a way to do XSL transformations in 
struts.xml.  If this works the way I think it does then you could return 
XML by all your actions and use the XSL to transform it to whatever 
output you want.  Nifty for multi-platform applications.

Does that help?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message