JBoss AS 7.1.0.Final에 배포합니다.왜 ViewScoped 빈이 살아남지 못합니다 h : commandButton?
나는 아주 간단한 테스트 응용 프로그램을 가지고 있습니다. 그것은 다른 날 (유명 마지막 단어)까지 예상대로 작동하고 있으며 더 이상 기본 요소를 수행하지 않습니다. 즉 입력 구성 요소의 값을 설정하고 동작 구성 요소에서 사용합니다. 나는 이걸 기본으로 없애고 무슨 일이 일어나는지 알 수 없다.
index.xhtml는
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<title>contacts</title>
</h:head>
<h:form>
<h:outputLabel value="Message:" />
<h:inputText value="#{contactView.siteCode}" />
<h:commandButton action="#{contactView.save}" value="Save" />
</h:form>
</html>
ViewScoped 콩은 내가 잘못하고있는 중이 야 여기에서
@Named
@ViewScoped
public class ContactView implements Serializable {
public ContactView() {
}
private String siteCode;
public String getSiteCode() {
System.out.println("getSiteCode: "+ siteCode);
return siteCode;
}
public void setSiteCode(String siteCode) {
System.out.println("setSiteCode: "+ siteCode);
this.siteCode = siteCode;
}
public String save(){
System.out.println("Saving sitecode: " + siteCode);
return "index.jsf";
}
}
여기입니까? 내가 저장 버튼을 클릭하면 나는 콩이되지 JSF @ManagedBean
에 의해, CDI @Named
에 의해 관리되기 때문이다 출력
10:50:37,663 INFO [stdout] (http--0.0.0.0-8080-2) setSiteCode: 22
10:50:37,663 INFO [stdout] (http--0.0.0.0-8080-2) Saving sitecode: null
10:50:37,663 INFO [stdout] (http--0.0.0.0-8080-2) getSiteCode: null
아마 다른 날에'@ Named' 대신'@ ManagedBean' 주석을 사용했을 것입니다. – Osw