Search code examples
javaxmlstruts2freemarkertaconite

Setting the content-type of a response in Struts2


So, I'm using freemarker templates with Struts2 to formulate my responses. However, since I'm trying to use taconite as well, I need the response to be sent with the content type of "text/xml". I can't seem to find a way to use freemarker directives to set the content type, and I am not well versed enough in struts to know if there is a way to do it through that.

So, how should I go about this?


Solution

  • Or you can set it in the struts.xml

    <action name="..." class="...">
      <result name="SUCCESS">
        <param name="contentType">text/html</param>