Struts2,如何将@Result类型参数定义为tiles结果
我在定义 @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]
i am having trouble defining 'type' parameter of @Result annotation
here is my action annotation:
@Action(value="login",
results=@Result(name="success",location="index.page", type="tiles" ))
where index.page is my tiles definition, how do i define that 'tiles' is actually tiles result ?
before i was using struts.xml for config, and i could just place there
<result-types>
<result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult" />
</result-types>
whatever i try i always get:
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]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是我在基于注释的休息设置中使用的配置。您的结果类型需要包装在您用于操作的任何默认包中:
Here is the configuration I use in my annotations based rest setup. Your result types need to be wrapped in whatever default package you're using for your actions:
您应该在扩展tiles-default的包中定义您的结果。
在动作类中
you should define your results in a package that extends tiles-default.
and in the action class