-
1. Re: Reset viewId on a4j:include
ilya_shaikovsky Dec 23, 2009 3:42 AM (in response to ventmonkey)just define viewId with EL binding to some bean property and reset it in cancel/save actions. -
2. Re: Reset viewId on a4j:include
ventmonkey Dec 23, 2009 3:19 PM (in response to ilya_shaikovsky)Thank you so much Ilya. That did the trick. For anyone else using seam to runs into this problem...please see 6.9 of http://docs.jboss.org/seam/2.0.1.CR1/reference/en/html/conversations.html for How to set up the binding. -
3. Re: Reset viewId on a4j:include
bitec Jan 24, 2010 4:38 AM (in response to ventmonkey)Hi.
I have problems with implementing what Ilya advised
First I tried to set the viewId through the bean property:
<a4j:include viewId="#{bean.viewId}" />
Then tried binding:
<a4j:include binding="#{orderDetailsBean.quickClosePanel}" viewId="template/orders/quick_close_order_modal.xhtml" />OrderDetails Bean:
public class OrderDetailsBean {
private Include quickClosePanel;
....
}
and reseting the value id on the close operation (this is the seam conversational bean, which calls orderDetailsBean for bound include):
@End
public void endConversation() {
orderDetails().getQuickClosePanel().setViewId("template/orders/quick_close_order_modal.xhtml");
}Interesting, that at the moment of calling "setViewId" method the include already has the initial "template/orders/quick_close_order_modal.xhtml" value. So this setter is not necessary at all. But anyway the last view in the include is shown, not the first one.
-
4. Re: Reset viewId on a4j:include
ilya_shaikovsky Jan 25, 2010 6:17 AM (in response to bitec)seems you not reRender'ed your wizard.
-
5. Re: Reset viewId on a4j:include
bitec Jan 28, 2010 8:34 AM (in response to ilya_shaikovsky)On which stage?
I rerender the wizard on its opening. I tried also to rerender it on last wizard page close, but this results on last page show.
Here are my snippets:
main page:
<!-- Link -->
<a4j:commandLink action="#{quickCloseOrderBean.prepareClose}"
oncomplete="if (!isError(#{facesContext.maximumSeverity.ordinal})) rerenderQuickClose();"
value="#{orders_bundle.quickClose}">
<a4j:jsFunction name="rerenderQuickClose" reRender="quick_close_area"/>
.....
<!-- Wizard -->
<a4j:outputPanel>
<a4j:include binding="#{orderDetailsBean.quickClosePanel}"
viewId="template/orders/quick_close_order_modal.xhtml" id="quick_close_area" />
</a4j:outputPanel>quick_close_order_modal.xhtm (first view in the wizard)l:
<al:confirmationModal showWhenRendered="#{quickCloseOrderBean.conversationStarted}"
backingBean="#{quickCloseOrderBean}"
action="doClose">
....
</al:confirmationModal>
<!-- <al:confirmationModal > - is a facelets tag, containing the rich:modalPanel with two buttons 'ok' and 'cancel'. On 'ok' click the quickCloseOrderBean.doClose() action is called, which returns the next page viewId - the 'quick_close_order_result.xhtml. -->quick_close_order_result.xhtml (the last view in the wizard):
<al:alertModal showWhenRendered="#{quickCloseOrderBean.conversationStarted}"
backingBean="#{quickCloseOrderBean}"
action="endConversation" reRender="detForm, quick_close_area">
<!-- <al:alertModal > - is a facelets tag, containing the rich:modalPanel with the only button 'ok'. This ends the conversation and closes the modal panel. -->I tried different ways, on the close of the last modal panel ("endConversation" method) I reset the viewId of the a4j:include (although it is already set to the initial value!!), I even rerender the a4j:include (I tried to rerender the container, where a4j:include is located) - but again on the link click I see the last viewId, not the first one...
Any help appreciated!
-
6. Re: Reset viewId on a4j:include
ilya_shaikovsky Jan 29, 2010 5:13 AM (in response to bitec)finally found an article which contains good sample of include reset. http://java.dzone.com/articles/jboss-richfaces-spring?page=0,0 -
7. Re: Reset viewId on a4j:include
bitec Jan 31, 2010 7:14 AM (in response to ilya_shaikovsky)Hi.
I found the resolution to the issue at last...
I used the keepAlive tag for my orderDetails bean. And the binding #{orderDetails.quickClosePanel} didn't work correctly in this case - meaning that the manual changings to the bound Include component didn't affect the real component tree and the component itself.. I cannot actually explain why, but I can say, that bindings should be used very carefully with those beans, which are serialized to the component tree (a4j:keepAlive is used). May be Ilya could better explain this interesting issue...
So, if anyone is interested - the code, which I provided above (with binding) works well, but do not bind the include tag to the bean, which is serialized through the requests! Take a simple request bean and use it
Ilya, thanks for your support again, it's great to know, that the one will not be left alone with any RF problems
-
8. Re: Reset viewId on a4j:include
ilya_shaikovsky Feb 1, 2010 3:46 AM (in response to bitec)Yes, JSF components in general should not be placed to session scope (many explanations across this forum and at any JSF related resources present). And even worst idea is to serialize the bean which contains binding using keepAlive. It restored after restore phase. So request scoped bean created and binding object instantiated during restore component tree and then it gets overriden after keep alive restore bean.