f:subview - JSF標(biāo)簽 f:subview 的使用方法
可以使用f:subview包含指定的JSF頁(yè)面,或者其他JSF組件。
使用f:subview包含JSF頁(yè)面時(shí),被包含的頁(yè)面里只能包含有JSF組件,所有非JSF組件元素必須用f:verbatim標(biāo)簽進(jìn)行轉(zhuǎn)換。
f:subview的使用例:
main.jsp:
subpage.jsp - 子頁(yè)面文件
畫(huà)面顯示(略)
參考:
Sun JavaServer Faces API Specifications
Sun JavaServer Faces Tag Library Documentation
f:subview的使用例:

<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<f:view>
<hr>
使用方法1:
<f:subview id="id1">
<h:outputText value="3"></h:outputText>
<f:verbatim><br>World</f:verbatim>
</f:subview>
<hr>
使用方法2:
<f:subview id="id2">
<c:import url="subpage.jsp" />
</f:subview>
<hr>
使用方法3:
<f:subview id="id3">
<%@ include file="subpage.jsp" %>
</f:subview>
<hr>
使用方法4:
<f:subview id="id4">
<jsp:include page="subpage.jsp" />
</f:subview>
</f:view>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<f:view>
<hr>
使用方法1:
<f:subview id="id1">
<h:outputText value="3"></h:outputText>
<f:verbatim><br>World</f:verbatim>
</f:subview>
<hr>
使用方法2:
<f:subview id="id2">
<c:import url="subpage.jsp" />
</f:subview>
<hr>
使用方法3:
<f:subview id="id3">
<%@ include file="subpage.jsp" %>
</f:subview>
<hr>
使用方法4:
<f:subview id="id4">
<jsp:include page="subpage.jsp" />
</f:subview>
</f:view>

<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<f:verbatim>subpage.</f:verbatim>
<h:outputText value="output component"></h:outputText>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<f:verbatim>subpage.</f:verbatim>
<h:outputText value="output component"></h:outputText>
畫(huà)面顯示(略)
參考:


posted on 2008-11-06 12:06 找個(gè)美女做老婆 閱讀(1774) 評(píng)論(0) 編輯 收藏