As usual, i've some trouble by using some ajax call on a requested scoped bean.
I've this 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 i do this 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 is always 1
. Seems that setter method is not called. This time is not a render fault, because that action is rendered on Apply request and Update model phases (in fact, System.out.println("ORDER = "+this.order);
trougth #{articlesSelector.articleList}
it's called every time i click on the image). So, what's up this time?
Request Scope make me a bit nervous :)
Thanks