org.apache.struts2.views.freemarker
类 FreemarkerResult

java.lang.Object
  继承者 org.apache.struts2.dispatcher.StrutsResultSupport
      继承者 org.apache.struts2.views.freemarker.FreemarkerResult
所有已实现的接口:
com.opensymphony.xwork2.Result, Serializable, StrutsStatics

public class FreemarkerResult
extends StrutsResultSupport

Renders a view using the Freemarker template engine.

The FreemarkarManager class configures the template loaders so that the template location can be either

This result type takes the following parameters: Example:
 

 <result name="success" type="freemarker">foo.ftl</result>

 
 

另请参见:
序列化表格

字段摘要
 
从类 org.apache.struts2.dispatcher.StrutsResultSupport 继承的字段
DEFAULT_PARAM
 
从接口 org.apache.struts2.StrutsStatics 继承的字段
HTTP_REQUEST, HTTP_RESPONSE, PAGE_CONTEXT, SERVLET_CONTEXT, SERVLET_DISPATCHER, STRUTS_ACTION_TAG_INVOCATION, STRUTS_PORTLET_CONTEXT
 
构造方法摘要
FreemarkerResult()
           
FreemarkerResult(String location)
           
 
方法摘要
 void doExecute(String locationArg, com.opensymphony.xwork2.ActionInvocation invocation)
          Execute this result, using the specified template locationArg.
 String getContentType()
          allow parameterization of the contentType the default being text/html
 boolean isWriteIfCompleted()
           
 void setContentType(String aContentType)
           
 void setFreemarkerManager(FreemarkerManager mgr)
           
 void setWriteIfCompleted(boolean writeIfCompleted)
          Writes to the stream only when template processing completed successfully
 void setWriter(Writer writer)
           
 
从类 org.apache.struts2.dispatcher.StrutsResultSupport 继承的方法
execute, getLastFinalLocation, getLocation, setEncode, setLocation, setParse
 
从类 java.lang.Object 继承的方法
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

FreemarkerResult

public FreemarkerResult()

FreemarkerResult

public FreemarkerResult(String location)
方法详细信息

setFreemarkerManager

public void setFreemarkerManager(FreemarkerManager mgr)

setContentType

public void setContentType(String aContentType)

getContentType

public String getContentType()
allow parameterization of the contentType the default being text/html


doExecute

public void doExecute(String locationArg,
                      com.opensymphony.xwork2.ActionInvocation invocation)
               throws IOException,
                      freemarker.template.TemplateException
Execute this result, using the specified template locationArg.

The template locationArg has already been interoplated for any variable substitutions

this method obtains the freemarker configuration and the object wrapper from the provided hooks. It them implements the template processing workflow by calling the hooks for preTemplateProcess and postTemplateProcess

参数:
locationArg - the location (jsp page, action, etc) to go to.
invocation - the execution state of the action.
抛出:
IOException
freemarker.template.TemplateException

setWriter

public void setWriter(Writer writer)

isWriteIfCompleted

public boolean isWriteIfCompleted()
返回:
true write to the stream only when template processing completed successfully (false by default)

setWriteIfCompleted

public void setWriteIfCompleted(boolean writeIfCompleted)
Writes to the stream only when template processing completed successfully