Kiran Pophale
Kiran Pophale

Reputation: 43

JSF 2 Primefaces : On Ajax reponse I can see extra updates sent by server <update id="javax.faces.Resource"> and which cause my action skipped

I am using JSF 2.0 and Prime faces 12 in my application, I do have added spring security to handle the application security. Now I can see that few command link action getting skipped and it is not working as expcted.

<h:commandLink
                            id="#{menuItem.tabId}"
                            styleClass="nav-link"
                            title="#{text[menuItem.text]}">
                        <p:ajax event="click"
                                process="@this"
                                update="@this"
                                listener="#{menuItem.preOpenAction}"
                                onsuccess="
                                    UTIL.desktopSwitch.addTab({
                                        headerType: 'iconTab',
                                        headerIcon:'#{menuItem.iconClass}',
                                        title: '#{text[menuItem.text]}',
                                        tabId: '#{menuItem.tabId}',
                                        tabSrc: '#{menuItem.link}',
                                        refreshOnUpdate: #{menuItem.refreshTabOnLoad}
                                    });
                                "
                        />
                        <i
                                class="nav-link-icon icon icon-16 #{menuItem.iconClass}"
                                style="margin-top: 0;"></i>
                        <span class="nav-link-text">#{text[menuItem.text]}</span>
                    </h:commandLink>

When I saw in browser response I am getting

 <?xml version="1.0" encoding="UTF-8"?><partial-response id="j_id__v_0"><changes><update id="javax.faces.Resource"><![CDATA[<link rel="stylesheet" type="text/css" href="/pc/javax.faces.resource/fonts.css.html?ln=common.css" /><link rel="stylesheet" type="text/css" href="/pc/javax.faces.resource/mbcpos_layout_v6.css.html?ln=common.css" /><link rel="stylesheet" type="text/css" href="/pc/javax.faces.resource/pegasus_layout_v2.css.html?ln=common.css" /><style type="text/css">
        canvas.drawing, canvas.drawingBuffer {
            position: absolute;
            left: 0;
            top: 0;
        }
    </style><script type="text/javascript" src="/pc/javax.faces.resource/jquery/jquery.js.html?ln=primefaces&amp;v=12.0.0&amp;e=12.0.6"></script><script type="text/javascript" src="/pc/javax.faces.resource/jquery/jquery-plugins.js.html?ln=primefaces&amp;v=12.0.0&amp;e=12.0.6"></script><script type="text/javascript" src="/pc/javax.faces.resource/core.js.html?ln=primefaces&amp;v=12.0.0&amp;e=12.0.6"></script><link rel="stylesheet" type="text/css" href="/pc/javax.faces.resource/components.css.html?ln=primefaces&amp;v=12.0.0&amp;e=12.0.6" /><script type="text/javascript" src="/pc/javax.faces.resource/components.js.html?ln=primefaces&amp;v=12.0.0&amp;e=12.0.6"></script><script type="text/javascript" src="/pc/javax.faces.resource/primefaces-extensions.js.html?ln=primefaces-extensions&amp;v=12.0.0&amp;e=12.0.6"></script><script type="text/javascript" src="/pc/javax.faces.resource/jsf.js.html?ln=javax.faces"></script><link rel="stylesheet" type="text/css" href="/pc/javax.faces.resource/styles.22ba24dbfa288503.css.html?ln=feedback-service-ui" />]]></update><update id="headerForm:userLogout"><![CDATA[<a href="#" onclick="jsf.util.chain(this, event,'PrimeFaces.ab({s:this,e:&quot;click&quot;,f:&quot;headerForm&quot;,p:&quot;headerForm:userLogout&quot;,u:&quot;headerForm:userLogout&quot;,onsu:function(data,status,xhr){              UTIL.desktopSwitch.addTab({               headerType: \'iconTab\',               headerIcon:\'icon-logout\',               title: \'logout\',               tabId: \'userLogout\',               tabSrc: \'\',               refreshOnUpdate: false              });             ;}});'); return false;" id="headerForm:userLogout" name="xxxxx" class="nav-link">
                                        <span class="nav-link-text">logout</span></a>]]></update><update id="j_id__v_0:javax.faces.ViewState:1"><![CDATA[CTE0Jppq8TxTDjtcyl0K/c6Pm8vUbwtRnGI2mM7jqEu3GoGs]]></update></changes></partial-response> 

I feel due to not required first update element in reponse it causes command link action or ajax listner get skipped and it is not working as expected

Do you know how can I overcome this issue?

Upvotes: 0

Views: 70

Answers (0)

Related Questions