0

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>
Lain
  • 2,166
  • 4
  • 23
  • 47
Mohsin AR
  • 2,998
  • 2
  • 24
  • 36

1 Answers1

1

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.

chkal
  • 5,598
  • 21
  • 26
  • so you mean i should use – Mohsin AR Apr 03 '13 at 08:50
  • Yes. You should simply reference this method and then do whatever you want in there. As you are only sending an AJAX call that updates some part of the page, there is no reason for PrettyFaces navigation. PrettyFaces typically perform redirects to other pages. And I think you don't want this here, right? – chkal Apr 03 '13 at 18:53