JSF - Can @PostConstruct block setter method by using an ajax call?

前端 未结 2 638
攒了一身酷
攒了一身酷 2021-01-21 18:09

I think the question is clear by the title. This is my actual bean :

@ManagedBean(name=\"selector\")
@RequestScoped
public class Selector {
    private String pr         


        
相关标签:
2条回答
  • 2021-01-21 18:29

    As BalusC indicates, having a rendered attribute set to false at a postback is quite often a cause for action methods not being executed. This typically happens when such attribute defaults to false and is only later in the JSF life-cycle (i.e. after apply request values) set to true.

    Defaulting to true (if possible) or remembering the value of this attribute by using the view scope or something like the Tomahawk saveState tag often gets you around this problem.

    In addition I would like to mention that next to PostConstruct, AJAX also should have nothing to do with this problem.

    0 讨论(0)
  • 2021-01-21 18:41

    Sometimes I'm setProfilePage is totally absent.

    That can happen when the UICommand component is not rendered in the component tree during apply request values phase and/or update model values phase. I.e. the rendered attribute of it or one of its parents has evaluated false at that point.

    The presence of @PostConstruct should not have any influence.

    0 讨论(0)
提交回复
热议问题