Born burn
Born burn

Reputation: 15

updating elements in primefaces with spring webflow

I'm wondering what is proper way to update elements on my page after event from another element. Lets say I have stateless bean which use services to get data for me, and I have scoped bean which is data model for my elements, scoped bean gets data when flow start in evaluate element from stateless bean. And now how should I get new data from stateless bean to scoped bean and re render elements with new values? Use remote command? It depends on elements? I hope YOu will get my point. I will appreciate any help, samples, whatever :)

Upvotes: 0

Views: 420

Answers (1)

Mikita Belahlazau
Mikita Belahlazau

Reputation: 15434

I didn't work with jsf+spring, but you can trye following:

public class MyScopedBean {

    @Autowired
    private MyStatelessBean statelessBean;

    private String someProperty;

    // getter, setter for someProperty
    // ...

    public void update() {
        someProperty = statelessBean.getDataFrowAnywhere();
    }
} 

On you page:

<p:outputText id="foo" value="#{scopedBean.someProperty}"/>
<p:commandButton action="#{scopedBean.updateData}" update="foo"/>

Upvotes: 1

Related Questions