org.apache.struts2.dispatcher
类 VelocityResult
java.lang.Object
org.apache.struts2.dispatcher.StrutsResultSupport
org.apache.struts2.dispatcher.VelocityResult
- 所有已实现的接口:
- com.opensymphony.xwork2.Result, Serializable, StrutsStatics
public class VelocityResult
- extends StrutsResultSupport
Using the Servlet container's JspFactory
, this result mocks a JSP
execution environment and then displays a Velocity template that will be
streamed directly to the servlet output.
This result type takes the following parameters:
- location (default) - the location of the template to process.
- parse - true by default. If set to false, the location param will
not be parsed for Ognl expressions.
This result follows the same rules from StrutsResultSupport
.
Example:
<result name="success" type="velocity">
<param name="location">foo.vm</param>
</result>
- 另请参见:
- 序列化表格
VelocityResult
public VelocityResult()
VelocityResult
public VelocityResult(String location)
setDefaultEncoding
public void setDefaultEncoding(String val)
setVelocityManager
public void setVelocityManager(VelocityManager mgr)
doExecute
public void doExecute(String finalLocation,
com.opensymphony.xwork2.ActionInvocation invocation)
throws Exception
- Creates a Velocity context from the action, loads a Velocity template and executes the
template. Output is written to the servlet output stream.
- 参数:
finalLocation
- the location of the Velocity templateinvocation
- an encapsulation of the action execution state.
- 抛出:
Exception
- if an error occurs when creating the Velocity context, loading or executing
the template or writing output to the servlet response stream.