0

I'm using netbeans with glassfish

In my .xhtml file, a have a link which I expect to call action shopBean.instructorScheduleById()

<p:commandLink styleClass="tooltip tour-sched" 
    rendered="#{shopBean.instructorSchedule!=null}"
    update=":dialogFormTS" action="#
    {shopBean.instructorScheduleById()}"                                             
    oncomplete="dlgTS.show()" process="@this"                                              
    ajax="true">TS<h:outputText styleClass="tooltiptext" 
    value="#{shopBean.instructorSchedule.name}"/>
</p:commandLink>

Bean file

@ManagedBean(name = "shopBean")
@SessionScoped
public class ShopBean {

    public ShopBean() {}

    public void getInstructorScheduleById(){
        System.out.println("hello");

    }


}

I looked to my Developer tools under network i see there is an ajax request but when i looked on glassfish output, there's no word hello

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Heero Yuy
  • 614
  • 9
  • 24

1 Answers1

2

Base on what i have learned here at stackoverflow, the get prefix is used for getter methods which means it must have a return value.

public void sum(){
    int num1 = 1;
    int num2 = 2;
    System.out.println(num1 + num2);
}
// xhtml
<p:commandButton action="#{bean.sum()}" />

if you want get the value from a getter method:

pivate int sum;
public int getSum(){
    return this.sum;
}
public void setSum(sum){
    this.sum = sum;
}
// xhtml
<p:outputText value="#{bean.sum}" />

The quick solution for your problem is to remove the get prefix in your bean.

cjslv
  • 377
  • 3
  • 15