0

I have a p:commnandButton as follows

    <p:commandButton id="previouscat" 
                   value="Go to #{categoryBean.getPreviousCategory().name}" 
                   style="margin:0px;" icon="ui-icon-back" update="@all" 
                   action="#{categoryBean.selectPreviousCat}"/>

which is inside a form. Now my problem is that when clicking on the button, the action doesn't execute cause then it should change the value of the button. I've tryed with setting the action function like categoryBean.selectPreviousCat & categoryBean.selectPreviousCat() with no success.

public void selectPreviousCat(){
        this.selectedCategory = this.getPreviousCategory();
}
Rodrigo Martinez
  • 913
  • 3
  • 13
  • 29
  • Just for testing: use `update="@this" process="@this"` and instead of action `actionListener="#{categoryBean.selectPreviousCat()}"` – stg May 08 '14 at 17:23
  • 1
    Also why do you write `#{categoryBean.getPreviousCategory().name}"` instead of `#{categoryBean.previousCategory.name}"`? – stg May 08 '14 at 17:32
  • It is hard to say from such a small snippet of xhtml page, it would be better if you'd extend it a bit. But, is your button placed somewhere within tag ` `? If the `` is missing, seemingly submitted values don't really reach the bean. – Veronika May 09 '14 at 05:31
  • @Veronika yes, I have the command button within the tag form – Rodrigo Martinez May 09 '14 at 12:09
  • @stg I dont use #{categoryBean.previousCategory.name}" because previous category is not an attibute of bean, is just a method I implemented – Rodrigo Martinez May 09 '14 at 12:13

0 Answers0