Struts2,如何将@Result类型参数定义为tile结果

sv1*_*v13 0 annotations struts2 tiles2

我无法定义@Result注释的'type'参数

这是我的动作注释:

@Action(value="login", 
    results=@Result(name="success",location="index.page", type="tiles" ))
Run Code Online (Sandbox Code Playgroud)

其中index.page是我的tile定义,我如何定义'tiles'实际上是tile结果?

在我使用struts.xml进行配置之前,我可以放在那里

<result-types>
    <result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult" />
</result-types>
Run Code Online (Sandbox Code Playgroud)

无论我尝试什么,我总是得到:

SEVERE: Dispatcher initialization failed
Unable to load configuration. - [unknown location]
...
Caused by: The Result type [tiles] which is defined in the Result annotation ... 
could not be found as a result-type defined for the Struts/XWork package 
[com.action#convention-default#] - [unknown location]
Run Code Online (Sandbox Code Playgroud)

Rus*_*ton 6

这是我在基于注释的休息设置中使用的配置.您的结果类型需要包装在您用于操作的任何默认包中:

<constant name="struts.convention.default.parent.package" value="restful"/>

<package name="restful"  extends="rest-default, struts-default, json-default">
    <result-types>
        <result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult" />
        <result-type name="json" class="com.googlecode.jsonplugin.JSONResult"/>
    </result-types> 

</package>
Run Code Online (Sandbox Code Playgroud)