문제점 : 관리 빈은 템플리트별로 주입하지 않습니다.JSF 2.0 MB의 템플리트 및 삽입 || CDI bean
목표 : 템플릿의 로그 아웃 버튼을 줄이려고합니다.
시나리오 : 웹 파트 용 jsf 2.0으로 j2ee 6 응용 프로그램을 빌드하고 있습니다.
템플릿 파일 레이아웃/template.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"
xmlns:f="http://java.sun.com/jsf/core"
>
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link href="/resources/css/default.css" rel="stylesheet" type="text/css"/>
<link href="/resources/css/cssLayout.css" rel="stylesheet" type="text/css"/>
<title>Facelets Template</title>
</h:head>
<h:body>
<div id="baner" class="baner" >
<ui:insert name="baner" >
<h:panelGrid style="color:blue; width:100%; height:100px;" border="5">
Baner Name go here
</h:panelGrid>
</ui:insert>
</div>
<div id="menu" class="menu">
<ui:insert name="menu">
some...
</ui:insert>
</div>
<div id="top" class="top">
<ui:insert name="top">Top Section</ui:insert>
</div>
<div>
<div id="left">
<ui:insert name="left">
<h:commandButton value="Do log out" action="#{securityBacking.invalidate}" />
<h:commandButton value="log out" action="#{securityBacking.logout}" />
</ui:insert>
<!--log out-->
</div>
<div id="content" class="left_content">
<ui:insert name="content">Main Content</ui:insert>
</div>
</div>
</h:body>
</html>
tempalte 클라이언트 index.xhtml :
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
SecurityBacking.java web.xml에
<!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:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:vt="http://java.sun.com/jsf/composite/security">
<body>
<ui:composition template="layout/template.xhtml">
<ui:define name="top">
<h:form>
<h:panelGrid border="4">
<!--TODO add i18n-->
<p style="color:red;">Partner`s login.</p>
<vt:loginPanel/>
<f:view>
<h:outputLabel value="#{rulesBean.userPrincipalName}"/>
<h:outputLabel value="#{rulesBean.user}"/>
<h:outputLabel value="#{rulesBean.manager}"/>
<h:commandButton value="Do log out" action="#{securityBacking.invalidate}" />
<h:commandButton value="log out" action="#{securityBacking.logout}" />
</f:view>
</h:panelGrid>
</h:form>
</ui:define>
</ui:composition>
</body>
</html>
얼굴 선언 :
,210당신이보다시피 :
<h:commandButton value="log out" action="#{securityBacking.logout}" />
및
<h:commandButton value="Do log out" action="#{securityBacking.invalidate}" />
레이아웃/template.xhtml & index.xhtml에서 감속하고 있지만 레이아웃에 감속 버튼/template.xhtml가 작동하지 샘 시간에, 그들은 index.xhtml에서 일하고 있습니다.
내가 사파리 웹 관리자를 찾고 난 참조 : index.xhtml
<input xmlns="http://www.w3.org/1999/xhtml" type="submit" name="j_idt12:j_idt29" value="log out" />
과 레이아웃에 감속을 위해
/template.xhtml
<input xmlns="http://www.w3.org/1999/xhtml" type="submit" name="j_idt32" value="log out" />
나는 콩을하지 알고있는 것처럼 태그 내부에 daclet 템플릿을 삽입하고 있지만, 이것에 대해서는 j2ee 6 튜토리얼 & 스펙이나 어쩌면 рфмут'е 고 공지 한 정보에서 찾을 수는 없습니다.
1 : 맞나요? 맞나요?
질문 2 : 왜 템플릿을 통해 주입하지 않습니까?
질문 3 :이 경우 템플릿 작성의 다른 방법은 무엇입니까?
질문 4 :이 경우 가장 좋은 방법은 무엇입니까?
는감사합니다 (I는 글래스 피쉬 V3 웹 서버를 사용하고 있습니다)!
감사합니다. 나는 그것을 약간 잃는다) –