제목에 의해 질문이 명확하다고 생각합니다. 이것은 나의 실제 콩입니다 :JSF - @PostAjax 호출을 사용하여 블록 설정 메소드를 생성 할 수 있습니까?
@ManagedBean(name="selector")
@RequestScoped
public class Selector {
private String profilePage;
@PostConstruct
public void init() {
System.out.println("I'm PostConstruct");
if(profilePage==null || profilePage.trim().isEmpty()) {
this.profilePage="main";
}
}
public String getProfilePage() {
return profilePage;
}
public void setProfilePage(String profilePage) {
this.profilePage=profilePage;
System.out.println("I'm setProfilePage");
}
}
그리고 난 아약스 호출을 사용하여 자신의 값 (profilePage)를 변경 :
<h:commandButton value="Some Action">
<f:setPropertyActionListener target="#{selector.profilePage}" value="some" />
<f:ajax event="action" render=":profileContent"/>
</h:commandButton>
내가 서버 내 출력 I'm setProfilePage
다음 I'm PostConstruct
의 시퀀스 적없는 것을 알 수 . 때로는 I'm setProfilePage
가 전혀 없습니다.
@PostConstruct
이 설정 메소드와 충돌 할 수 있는지 알고 싶습니다.
건배
실제로 렌더링 된 속성을 false로 설정하지 않았습니다. 내 문제의 예를 여기에서 볼 수 있습니다. http://stackoverflow.com/questions/4292330/jsf-ajax-call-what-is-it-wrong-on-this-code – markzzz