0
我在Linux上使用Netbeans 7.4 Mint 13 Maya 。我學習如何編寫一個簡單的JSF複合組件。但我有一些錯誤:NETBEANS 7.4:「沒有標籤被定義爲名稱:寄存器」+「沒有找到名稱空間的庫http://java.sun.com/jsf/composite/my_composite_component」
,當我嘗試推出我的應用程序:
<my_composite_component:register> Tag Library supports namespace: http://java.sun.com/jsf/composite/my_composite_component, but no tag was defined for name: register
,當我嘗試使用我的組件:
「No library found for namespace http://java.sun.com/jsf/composite/my_composite_component」
繼承人在我的NetBeans項目的目錄結構:
,代碼:
register.xhtml - 我複合材料構件
<?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:composite="http://java.sun.com/jsf/composite"
>
<composite:interface>
<composite:attribute name="nameLable" />
<composite:attribute name="nameValue" />
<composite:attribute name="emailLable" />
<composite:attribute name="emailValue" />
<composite:attribute name="registerButtonText" />
<composite:attribute name="registerButtonAction"
method-signature="java.lang.String action()" />
</composite:interface>
<composite:implementation>
<h:form>
<h:message for="textPanel" style="color:red;" />
<h:panelGrid columns="2" id="textPanel">
#{cc.attrs.nameLable} :
<h:inputText id="name" value="#{cc.attrs.nameValue}" />
#{cc.attrs.emailLable} :
<h:inputText id="email" value="#{cc.attrs.emailValue}" />
</h:panelGrid>
<h:commandButton action="#{cc.attrs.registerButtonAction}"
value="#{cc.attrs.registerButtonText}"
/>
</h:form>
</composite:implementation>
</html>
和的index.xhtml,我嘗試使用我的組件:
<?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:my_composite_component="http://java.sun.com/jsf/composite/my_composite_component"
>
<h:body>
<h1>Composite Components in JSF 2.0</h1>
<my_composite_component:register
nameLable="Name"
nameValue="#{user.name}"
emailLable="E-mail"
emailValue="#{user.email}"
registerButtonText="Register"
registerButtonAction="#{user.registerAction}"
/>
</h:body>
</html>