ajax - JSF - Why setter is not called this time? -
as usual, i've trouble using ajax call on requested scoped bean.
i've bean :
@managedbean @requestscoped public class articlesselector implements serializable { @managedproperty(value="#{param.type}") private string type; private string zone; private string order; @postconstruct public void init() { if(type==null || type.trim().isempty()) { this.type="1"; } if(zone==null || zone.trim().isempty()) { this.zone="list"; } if(order==null || order.trim().isempty()) { this.order="1"; } } public string gettype() { return type; } public void settype(string type) { this.type = type; } public string getzone() { return zone; } public void setzone(string zone) { this.zone=zone; } public string getorder() { return order; } public void setorder(string order) { this.order = order; } public arraylist<string[]> getarticlelist() { ... system.out.println("order = "+this.order); ... } }
when call :
<h:panelgroup layout="block" id="articlescontent"> <h:form id="formarticles"> <h:outputscript name="jsf.js" library="javax.faces" target="head" /> <h:panelgroup rendered="#{articlesselector.zone=='list'}"> <h:panelgroup layout="block" id="articlescontentlist"> <h:commandlink> <f:setpropertyactionlistener target="#{articlesselector.order}" value="2" /> <f:ajax event="click" render=":articlescontent"/> <h:graphicimage value="img/arrow_down.png" alt="arrow down"/> </h:commandlink> <h:outputlabel value="#{articlesselector.articlelist}" /> </h:panelgroup> </h:panelgroup> </h:form> </h:panelgroup>
the order value 1
. seems setter method not called. time not render fault, because action rendered on apply request , update model phases (in fact, system.out.println("order = "+this.order);
trougth #{articlesselector.articlelist}
it's called every time click on image). so, what's time?
request scope make me bit nervous :)
thanks
the f:ajax
should fired on event="action"
, not event="click"
.
yes, know ever suggested in comment of question use click
, apparently wrong™. sorry :)
Comments
Post a Comment