未调用接缝页面操作
我有一个显示实体的页面,但在渲染页面之前,我需要根据传入的参数执行实体查找。为此,我尝试使用在中声明的 Seam 页面操作我的pages.xml 文件在渲染页面之前调用查找操作。我的设置如下所示:
pages.xml:
<page view-id="/mypage.xhtml" action="#{mylookup.lookupEntity}"></page>
我的操作类:
@Name("myLookup")
@AutoCreate
public class MyLookup {
@RequestParameter
private String myParam;
...
public void lookupEntity() { ...}
...
}
对我来说一切看起来都很好,但是当我单击链接将我带到该页面时,我的lookupEntity()操作永远不会被调用。我添加了断点和日志语句,很明显它永远不会被调用。
造成这种情况的典型原因是什么?我是否应该在某个地方寻找有关失败原因的更多信息?
I've got a page that displays an entity, but before rendering the page I need to perform a lookup of the entity based on a parameter that is passed in. To do this, I'm trying to use a Seam Page Action declared in my pages.xml file to call the lookup action before rendering the page. My setup looks like this:
pages.xml:
<page view-id="/mypage.xhtml" action="#{mylookup.lookupEntity}"></page>
My action class:
@Name("myLookup")
@AutoCreate
public class MyLookup {
@RequestParameter
private String myParam;
...
public void lookupEntity() { ...}
...
}
Everything looks fine to me, but when I click on a link to take me to that page, my lookupEntity() action never gets called. I've added breakpoints and logging statements, and it's clear that it never gets called.
What is a typical cause for this? Is there someplace I should be looking for more info on why this failed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
很简单,因为调用的组件名称 (#{myLookup.lookupEntity}) 与组件名称 (#{myLookup.lookupEntity}) 不匹配。
Simply because the called component name (#{mylookup.lookupEntity}) does not match component name (#{myLookup.lookupEntity}).
我也怀疑它不起作用,直到我用 log.info 替换 log.trace 并看到它起作用。也许你们中的一些人也陷入了我经历过的同样的陷阱。
I also suspected it does not work, till I replace log.trace with log.info and saw that it does. Maybe some of you are falling on the same trap I went through.