0

@Result アノテーションの「type」パラメーターの定義に問題があります

ここに私のアクション注釈があります:

@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 に答える