Hello everyone,
I am having trouble to get s:conversationPropagation working with an
a4j:commandLink. I have a master/detail scenerio where a click on row of my
master page will open a new window with detail information. This new window is
opened through javascript and loaded with data through a page action. I also
start a conversation with explicit id when the new window is opened. In this
new window, I have various a4j:commandLink, which calls the same
conversation-scope bean to query and re-render the page (of course thru ajax).
However, I notice that whenever the link is clicked, a new conversation is
created and my previous data is not propagated over. Do you know what happens?
Here is my xhtml snippet of the detail screen:
<ul class="buttons-toggle">
| <li class="left">
| <a4j:commandLink action="#{detailsearch.applyScale1}"
styleClass="#{detailsearch.scale1ButtonStyle}" value="1x"
reRender="scaleWrapper" limitToList="true"
|
onclick="selectMe(this);" oncomplete="setBarHeight();">
| <s:conversationPropagation type="join"/>
| </a4j:commandLink>
| </li>
| <li>
| <a4j:commandLink action="#{detailsearch.applyScale2}"
styleClass="#{detailsearch.scale2ButtonStyle}" value="2x"
reRender="scaleWrapper" limitToList="true"
|
onclick="selectMe(this);" oncomplete="setBarHeight();">
| <s:conversationPropagation type="join"/>
| </a4j:commandLink>
| </li>
| <li class="right">
| <a4j:commandLink action="#{detailsearch.applyScale3}"
styleClass="#{detailsearch.scale3ButtonStyle}" value="3x"
reRender="scaleWrapper" limitToList="true"
|
onclick="selectMe(this);" oncomplete="setBarHeight();">
| <s:conversationPropagation type="join"/>
| </a4j:commandLink>
| </li>
| </ul>
Here is my pages.xml:
<page view-id="/account/details.xhtml"
action="#{detailsearch.findSessions(selectedAlertSession)}" >
|
| </page>
Here is my action bean:
@Name("detailsearch")
| @Scope(ScopeType.CONVERSATION)
| @GALoggedIn
| public class GAAccountDetailsAction {
|
| @In
| private Session gadb;
| @In
| private GAHostAppInfo hostApp;
| @In
| private FacesMessages facesMessages;
| @Logger
| private Log log;
| @DataModel
| private List<GASession> sessionList;
| @DataModelSelection
| private GASession dmSession;
|
| @In(required=false) @Out(required=false)
| private GASession selectedSession;
|
| private long totalSessions;
| private int scale;
| private GASession sessionTmpl;
| private List<GAUISessionProp> sessionPropList;
| private String maxOrMin;
| @Begin(id="#{selectedAlertSession.id}",join=true)
| public String findSessions(GASession selectedAlertSession) {
| log.debug("in findSessions(): selectedSession==null?" +
(selectedSession==null));
| try {
| if (selectedSession == null) {
| init();
| if (selectedAlertSession != null) {
| selectedSession = selectedAlertSession;
| totalSessions = countSessions();
| getSessions();
| } else {
|
facesMessages.addFromResourceBundle(Constants.NO_ACCOUNT_SELECTED);
| return "error";
| }
| }
| return "details";
| } catch (Throwable t) {
| log.error("Exception in findSessions()", t);
|
facesMessages.addFromResourceBundle(Constants.APPLICATION_ERROR);
| return "error";
| }
| }
|
| public void applyScale1() {
| try {
| log.debug("in applyScale1()");
| this.scale = 1;
| getSessions();
| } catch (Throwable t) {
| log.error("Error while applying scale", t);
|
facesMessages.addFromResourceBundle(Constants.APPLICATION_ERROR);
| }
| }
I also notice that after the applyScale1() method is called, the findSessions()
is called again due to page action. My question is since it is an ajax
request, shouldn't the page action be invoked? I thought page action is only
invoked when the page is rendered, does this imply every interaction to the
server from that page will cause JSF to render the page and hence, page action
is invoked?
Why s:conversationPropagation with type="join" doesn't join the previous
conversation?
Is there any better way to do achieve this if my current approach is not
working?
Thanks.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3996911#3996911
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3996911
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user