<?xml version='1.0' encoding='UTF-8' ?> <!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:p="http://primefaces.prime.com.tr/ui"> ....</html> xmlns:f="http://java.sun.com/jsf/core"
在以JSP作為視圖技術的JSF的頁面中是必需的。因為JSF的頁面其實在RAM中模型就是一棵樹,如下圖所示。理解這點非常重要,所以是必須有根節點。Facelets 的 FaceletViewHandler 會自動創建一個UIViewRoot,如果XHTML中沒有定義的話。
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/faeclets"
EL表達式<tag attribute="#{managedBean.property}" action="#{managedBean.action}" /> Sample code<!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"> <h:head><title>JSF 2.0: Success</title> <link href="./css/styles.css" rel="stylesheet" type="text/css"/> </h:head> <h:body> <div align="center"> <table border="5"> <tr><th class="title">JSF 2.0: Success</th></tr> </table> <p/> <h2>If you got this page after clicking on button in test.jsf, then your JSF 2.0 app is configured and deployed correctly.</h2> </div></h:body></html> |