开发者

why composite compoment does not invoke in the <h:datatable/>

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="#{userSe开发者_JS百科ssion.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!


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜