2015-06-19 20 views
-1

JSF 2.2時,JBoss 7.雖然運行其發展得越來越「標籤庫支持命名空間:http://java.sun.com/jsf/html,但沒有標籤被定義爲名稱:outputtext「這個錯誤..任何人都可以幫助我解決這個問題..<H:的outputText>標記庫支持的命名空間:http://java.sun.com/jsf/html,但沒有標籤被用於名定義:使用的outputText

下面是那個xhtml文件。錯誤在「」這一行上。

的index.xhtml:

<?xml version='1.0' encoding='UTF-8' ?> 
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<ui:composition 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" 
    xmlns:p="http://primefaces.org/ui" 
    xmlns:c="http://java.sun.com/jsp/jstl/core" 
    template="template/ui.xhtml"> 
<ui:define name="body"> 
    <h3>Welcome to JSF Lab</h3> 
    <h4>Pure JSF</h4> 

    <p> 
     <!-- Shows the error or success message --> 
     <h:outputtext value="#{fileUploadMBean.message}" 
     rendered="#{!empty fileUploadMBean.message}"> 
     </h:outputtext> 
     <!-- notice the enctype for file upload --> 
     <h:form prependid="false" enctype="multipart/form-data"> 
     <h:panelgrid> 
     <!-- input for files --> 
     <h:inputfile value="#{fileUploadMBean.file1}"></h:inputfile> 
        <h:inputfile value="#{fileUploadMBean.file2}"/> 
     <!-- action which is responsible for uploading file(s) --> 
     <h:commandbutton action="#{fileUploadMBean.uploadFile()}" value="Upload" /> 
     </h:panelgrid> 
     </h:form> 
    </p> 
     </ui:define> 
     </ui:composition> 

這是上面的XML文件中的Bean文件..這

FileUploadMBean.java 

@ManagedBean 
@ViewScoped 
public class FileUploadMBean implements Serializable { 
    private static final long serialVersionUID = 1L; 
    private Part file1; 
    private Part file2; 
    private String message; 
    public Part getFile1() { 
    return file1; 
    } 
    public void setFile1(Part file1) { 
    this.file1 = file1; 
    } 
    public Part getFile2() { 
    return file2; 
    } 
    public void setFile2(Part file2) { 
    this.file2 = file2; 
    } 
    public String getMessage() { 
    return message; 
    } 
    public void setMessage(String message) { 
    this.message = message; 
    } 
    public String uploadFile() throws IOException { 
    //upload code 
    } 
} 

我知道庫和版本都還好。因爲當我運行另一個xhtml的另一個bean類,它的工作很好,相同的h:outputtext顯示沒有錯誤..我不理解的問題。這是任何配置問題或其他事情。

+4

這是一個簡單的拼寫錯誤。 Java和XML是大小寫敏感的(如英語會話,順便說一句,你似乎一直未能牢牢按住Shift鍵在正確的時刻,不僅在碼,而且在英語)。請喝一杯好咖啡,並按照示例和文檔進行操作,並對Shift鍵付出更多愛與關注。編譯器和人類將會感恩。 – BalusC

+0

沒有解決方案還可以..我知道振振有辭其downvoted ...... – Jambu

+0

嗨BalusC.the上述問題被清除。現在,我得到「標籤庫支持的命名空間:java.sun.com/jsf/html,但沒有標籤被用於名定義:INPUTFILE」。儘管我使用jsf 2.2。我找不到解決方案。幫我。 – Jambu

回答

0

由於BalusÇ說,在評論其錯字錯

使用

<h:outputText> </h:outputText> 
<h:panelGrid></h:panelGrid> 
<h:commandButton action="#{fileUploadMBean.uploadFile}" value="Upload" ></h:commandButton> 
+0

嗨,上述問題已清除。現在,我得到「標籤庫支持的命名空間:http://java.sun.com/jsf/html,但沒有標籤被用於名定義:INPUTFILE」。儘管我使用jsf 2.2。我找不到解決方案。幫我。 – Jambu

相關問題