0

我在定义 @Result 注释的“类型”参数时遇到问题

这是我的动作注释:

@Action(value="login", 
    results=@Result(name="success",location="index.page", type="tiles" ))

index.page 是我的瓦片定义,我如何定义“瓦片”实际上是瓦片结果?

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

<result-types>
    <result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult" />
</result-types>

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

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]
4

2 回答 2

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>
于 2011-09-20T15:34:50.470 回答
0

您应该在扩展tiles-default 的包中定义结果。

<package name="ps" extends="json-default,tiles-default">

在动作课上

@Results({ 
    @Result(name = "success", location = "feedback_management.jsp")
    ,@Result(name = "listPage", 
    type = "tiles" ,location = "table.tiles")
})
于 2015-11-23T11:48:05.930 回答