Re: Problem setting contentType to "text/xml"
Jeromy Evans <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Organization | Blue Sky Minds Pty Ltd |
| Message-ID | <[email protected]> |
Anna Putnam wrote:
Ok, I must be missing something so I apologize
if this is a stupid
question….
My application is built using Struts 2, Sitemesh
and
Freemarker.
I am trying to generate a XML file using a ftl
file. I
cannot seem to get the contentType to be “text/xml”.
I tried including:
ServletActionContext.getResponse().setContentType("text/xml");
In my action but no luck? Any suggestions?
Thanks in advance.
Hi Anna,
The Struts2 FreeMakerResult accepts a parameter that defines the
contentType. See [1].
eg. in struts.xml
<result name="success", type="freemarker">
<param name="location">template.ftl</param>
<param name="contentType">text/xml</param>
</result>
Regards,
Jeromy Evans
References:
[1]
http://struts.apache.org/2.x/struts2-core/apidocs/org/apache/struts2/views/freemarker/FreemarkerResult.html
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Register now and save $200. Hurry, offer ends at 11:59 p.m.,
Monday, April 7! Use priority code J8TLD2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
FreeMarker-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freemarker-user