为什么复合组件不在中调用?
我有一个具有方法签名属性的组件。它可以被激活,但如果我把它放在
并触发该组件,它不起作用。
当我再次刷新此页面或将其放在其他位置时,它可以成功调用。如果有人能告诉我原因,我将不胜感激!
这是我的代码,
<h:column>
<f:facet name="header">op:</f:facet>
<h:commandLink value="alter" action="#{userSession.alterAction}"
rendered="#{userSession.user.power.powerID == 1}">
<f:param name="beanId" value="#{book.bookID}" />
<f:param name="class" value="#{BookBean}" />
</h:commandLink>
<h:commandLink action="#{userSession.detailAction}" value="detail"
rendered="#{userSession.user != null}">
<f:param name="beanId" value="#{book.bookID}" />
<f:param name="class" value="#{BookBean}" />
</h:commandLink>
<h:commandLink action="#{bookAction.bookDelAction}"
onclick="return confirm('are you sure?')" value="delete"
rendered="#{userSession.user.power.powerID == 1}">
<f:param name="beanId" value="#{book.bookID}" />
</h:commandLink>
</h:column>
当我单击此操作之一时,此 manageredBean #{bookAction} 是 requestScope,就像删除一样,它根本不起作用。但如果我将“删除”命令链接放在
之外。它可以成功调用支持方法。太不高兴了!
谁能告诉我,如果我将这些代码放在
.it 中,
是否可以屏蔽找到的 .i也可以调用!你能告诉我原因吗!
I have a compoment which has a method-signature attribute. It can be activated, but if I put it in a <h:datatable> <h:column/>
and trigger this component, it does not work.
When I just refresh this page again or when I put it in another place it can invoked successfully. I would be grateful if somebody can tell me why!
this is my code
<h:column>
<f:facet name="header">op:</f:facet>
<h:commandLink value="alter" action="#{userSession.alterAction}"
rendered="#{userSession.user.power.powerID == 1}">
<f:param name="beanId" value="#{book.bookID}" />
<f:param name="class" value="#{BookBean}" />
</h:commandLink>
<h:commandLink action="#{userSession.detailAction}" value="detail"
rendered="#{userSession.user != null}">
<f:param name="beanId" value="#{book.bookID}" />
<f:param name="class" value="#{BookBean}" />
</h:commandLink>
<h:commandLink action="#{bookAction.bookDelAction}"
onclick="return confirm('are you sure?')" value="delete"
rendered="#{userSession.user.power.powerID == 1}">
<f:param name="beanId" value="#{book.bookID}" />
</h:commandLink>
</h:column>
this manageredBean #{bookAction} is requestScope when i click one of this operation,just like delete ,it doesnot work at all. but if i put the 'delete' commandlink out of <h:datatabel/>
.it can invoke backing method successfully. it is so upset!
who can tell me whether <h:datatable/>
can Shielding the .i found if i put these code in a <h:form/>
.it can invoke too! cound you can tell me the reason!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要在请求期间保留完全相同的数据模型(即您通过
的value
属性引用的数据模型)表单提交就像在请求显示初始表单期间一样。这些症状表明您正在使用请求范围的 bean,并且数据模型的加载基于表单提交期间缺少的某些请求参数和/或在 bean 的(后)构造期间未完成加载。将 bean 放入视图范围和/或重新安排数据加载逻辑应该可以修复它。
You need to preserve exactly the same data model (i.e. the one which you have referenced by the
value
attribute of the<h:dataTable>
) in during the request of the form submit as it was during the request of displaying the initial form. The symptoms indicate that you're using a request scoped bean and that the loading of the data model is based on some request parameter which is missing during the form submit and/or the loading is not being done during bean's (post)construction.Putting the bean in the view scope and/or rearranging the data loading logic should fix it.