JSF - Why setter is not called this time?

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

Answers


The f:ajax should be fired on event="action", not event="click".

Yes, I know that I ever suggested in a comment of your question to use click, but I was apparently Wrong™. Sorry for that :)


Need Your Help

How to embed audio/video on HTML page that plays on iPhone browser over GPRS

iphone html

Although I don't have an iPhone to test this out, my colleague told me that embedded

Hide / Show Specific Table Rows

jquery html css

I need to be able to hide on default specific rows within a table.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.