JSF 2.2를 사용하여 복합 컴포넌트에 매개 변수로 지원 Bean 인스턴스를 전달하고 Bean 인스턴스에서 메소드를 호출 할 수 있습니까?
예가 있습니까? 도움 감사합니다.
알았어! 그리고 여기 내 해결책이 있습니다.
복합 구성 요소 :
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
xmlns:cc="http://java.sun.com/jsf/composite">
<cc:interface>
<cc:attribute name="backingBean" required="true" shortDescription="A backing bean to invoke polimorphic methods."/>
</cc:interface>
<cc:implementation>
<h:commandButton value="Foo" action="#{cc.attrs.backingBean.myPolimorphicMethod}"/>
</cc:implementation>
</html>
복합 구성 요소 사용 :
<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:cc="http://xmlns.jcp.org/jsf/composite/components"
xmlns:p="http://primefaces.org/ui"
template="/WEB-INF/templates/template.xhtml">
<ui:define name="content">
<h:form>
<cc:myCustomComponent backingBean="#{myBacking}"></cc:myCustomComponent>
</h:form>
</ui:define>
</ui:composition>
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다