Mohsin AR
Mohsin AR

Reputation: 3108

p ajax listener using pretty faces

I have a 2 combo boxes 1.company & 2.city, when I select any company from company's combo box, it will change city combo box on ajax my Question is that should I use

<p:ajax update="city" listener="pretty:cityOnChange" />

OR

<p:ajax update="city" listener="#{actionClass.cityOnChange}" />

when I use below statement I get exception
listener="pretty:cityOnChange": Cannot convert pretty:cityOnChange of type class java.lang.String to class javax.el.MethodExpression

<p:ajax update="city" listener="pretty:cityOnChange" />   

this is the code which I am using

<h:outputLabel value="select Company" />
<p:selectOneMenu id="companySelectId" value="#{circleAction.companyBeans.companyBeansId}">
<f:selectItems value="#{circleAction.companyBeans.companyMap}"/>
<p:ajax update="city" listener="pretty:cityOnChange" />
</p:selectOneMenu>

Upvotes: 0

Views: 514

Answers (1)

chkal
chkal

Reputation: 5668

No, you cannot use an PrettyFaces navigation string as a value for the listener attribute. The attribute must refer to method using an EL expression. Just like the exception tells you.

Upvotes: 1

Related Questions