1
<result-types>
2
<result-type name="dispatcher" default="true"
3
class="….dispatcher.ServletDispatcherResult"/>
4
<result-type name="redirect"
5
class="….dispatcher.ServletRedirectResult"/>
6
…
7
</result-types>
<result-types>2
<result-type name="dispatcher" default="true"3
class="….dispatcher.ServletDispatcherResult"/>4
<result-type name="redirect"5
class="….dispatcher.ServletRedirectResult"/>6
…7
</result-types>
Implementing Result Types
与拦截器相似,它可能创建出你自己的结果类型并将它们配置到你的WEB应用中.一些常用的结果类型已经存在,所以,在你创建自己的之前,你应该先看看你想创建的类型是否已经存在.
为了创建一个新的结果类型,实现Result接口即可.
1
public interface Result extends Serializable
{
2
public void execute(ActionInvocation invocation) throws Exception;
3
}

public interface Result extends Serializable
{2
public void execute(ActionInvocation invocation) throws Exception;3
}
ActionInvocation对象提供了对运行环境的访问,允许一个新的结果类型访问来自刚刚运行的action的信息,也可以访问执行action的上下文.上下文包括了HttpServletRequest对象,可提供对当前请求的输出流的访问.

