Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Save the text string as an InputStream property

Code Block
package actions;

import com.opensymphony.xwork2.ActionSupport;

public class TextResult extends ActionSupport {

  private InputStream inputStream;
  public InputStream getInputStream() {
    return inputStream;

  public String execute() throws Exception {
    inputStream = new StringBufferInputStream(
      "Hello World! This is a text string response from a Struts 2 Action.");	
    return SUCCESS;

Specify a Stream Result type

Code Block
<action name="text-result" class="actions.TextResult">
  <result type="stream">
     <param name="contentType">text/html</param>
     <param name="inputName">inputStream</param>