JSF 에 있 는 Composite Components 에 대해 서...
2738 단어 자바 잡담
이 Composite Components 는 특별한 템 플 릿 으로 component 를 만 들 수 있 습 니 다. 다른 것 은 모두 이해 할 수 있 습 니 다. 바로 이 coposite: editable Value Holder 입 니 다. Oracle 의 공식 문서 가 쓴 영 어 는 매우 빙빙 돌려 서 반나절 을 읽 었 지만 완전히 이해 하지 못 했 습 니 다.
composite:editableValueHolder
Declares that the composite component whose contract is declared by the
composite:interface
in which this element is nested exposes an implementation of EditableValueHolder
suitable for use as the target of attached objects in the using page. 예 를 들 어 대충 다음 과 같이 이해 했다.우선 이 editable Value Holder 는 composite implementation 을 가리 키 는 데 사 용 됩 니 다.
method-signature="java.lang.String action()"/>
주의 하 세 요. target 은 implementation 을 가리 키 는 것 입 니 다. 여기 form 이 있 습 니 다. 저 는 많은 문 서 를 찾 아 보 았 습 니 다. 저 는 form: 를 빼 면 틀 릴 것 입 니 다. 나중에 아래 implementation 이 form 안에 있다 는 것 을 알 게 되 었 습 니 다. 만약 에 제 가 implementation 을 form 에서 꺼 내 면 틀 리 지 않 습 니 다.이 target 은 여러 개 를 받 아들 이 고 쉼표 로 나 누 는 것 을 주의 하 십시오. 그러나 using page 에서 이 두 field 를 검증 해 야 하기 때문에 합 쳐 서 따로 검증 할 수 없습니다.
다음은 implementation 입 니 다.
target="head"/> value="#{cc.attrs.namePrompt}"/> value="#{cc.attrs.myLoginBean.name}" required="true"/> value="#{cc.attrs.passwordPrompt}"/> value="#{cc.attrs.myLoginBean.password}" required="true"/> value="#{cc.attrs.loginButtonText}" action="#{cc.attrs.loginAction}"/> showDetail="false" errorStyle="color: #d20005" infoStyle="color: blue"/>
그리고 이 건 using page 에서 사용 할 수 있 습 니 다.
loginAction="#{myLoginBean.login}"> for="vals" /> for="passwordVal"/>
이상 은 내 가 오늘 공부 한 소감 이다.