0

I have a command button which i bind its action method.

<f:view >
    <pm:page title="Title">
        <pm:view id="viewId" swatch="c">
            <p:outputPanel id="panelId">
                <h:form id="formId">   

    <p:commandButton action="#{bean.actionMethod}" update="formId" value="Click" />
                           </h:form>
                     </p:outputPanel>
               </pm:view>
    </pm:page >
</f:view>

Inside action method. the navigation refers the same page. Some values are updated inside action method.

public String applyPeriod(String caller)
{
    .....
    retrun SAMEPAGE;
}

Every thing is ok. but the styles is not rendered. the page returns to the default styles.

Any idea how i can load the styles. I do not want to change URL by doing real refresh. i should managed it by ajax calls.

I trace the requests of the page. There is exactly no call for styles.

I use primefaces, primefaces mobile and it is a mobile page.

erencan
  • 3,725
  • 5
  • 32
  • 50
  • In case your managed bean get re-initialized, check if your bean's properties also get re-initialized to some default value. – Mr.J4mes Mar 26 '13 at 08:30
  • 1
    Related: http://stackoverflow.com/questions/8634156/how-to-reference-components-in-jsf-ajax-cannot-find-component-with-identifier/ your current update client ID is looking for `` **inside** the form, it's not referring the form itself. – BalusC Mar 26 '13 at 16:15

2 Answers2

2

If you didn't use : behind your form's ID I believe the problem can be related to a relative component search, trying to finding the form based on a relative identifier. By using the different element's ID you're getting the expected behaviour, I pressume because they're correctly referenced in a relative way to the context of your <p:commandButton/>.

Try using either update="@form" or update=":formId". Also, as a side note, if you want to use full ajax and you won't be redirecting the user anywhere, your method should either be void or return null.

Fritz
  • 9,987
  • 4
  • 30
  • 49
  • detailed BalusC answer: http://stackoverflow.com/questions/8634156/how-to-reference-components-in-jsf-ajax-cannot-find-component-with-identifier/ – erencan Mar 27 '13 at 09:13
0

I really do not know the reason behind the scenes. However, i solved the issue by giving exact components ids to update attributes of commandButton.

<p:commandButton action="#{bean.actionMethod}" update="ListOfComponentIds" value="Click" />
erencan
  • 3,725
  • 5
  • 32
  • 50