2013-07-11 23 views
0

我的web.xml文件JSF2.0 tomcat6.x和Rich面臨3.3錯誤

<?xml version="1.0" encoding="UTF-8"?> 
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"   
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee  
    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> 

    <context-param> 
     <param-name>javax.faces.PROJECT_STAGE</param-name> 
     <param-value>Production</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> 
    <context-param> 
     <param-name>javax.faces.DISABLE_FACELET_JSF_VIEWHANDLER</param-name> 
     <param-value>true</param-value> 
    </context-param> 

    <context-param> 
     <param-name>org.richfaces.SKIN</param-name> 
     <param-value>blueSky</param-value> 
    </context-param> 


    <!--Configuration for Richfaces--> 
    <filter> 
     <display-name>RichFaces Filter</display-name> 
     <filter-name>richfaces</filter-name> 
     <filter-class>org.ajax4jsf.Filter</filter-class> 
    </filter> 
    <filter-mapping> 
     <filter-name>richfaces</filter-name> 
     <servlet-name>Faces Servlet</servlet-name> 
     <dispatcher>REQUEST</dispatcher> 
     <dispatcher>FORWARD</dispatcher> 
     <dispatcher>INCLUDE</dispatcher> 
    </filter-mapping> 
    <!--End of the configuration part for Richfaces--> 

    <!--Configuration for Facelets--> 
    <context-param> 
     <param-name>javax.faces.DEFAULT_SUFFIX</param-name> 
     <param-value>.jsp</param-value> 
    </context-param> 
    <context-param> 
     <param-name>facelets.RECREATE_VALUE_EXPRESSION_ON_BUILD_BEFORE_RESTORE</param-name> 
     <param-value>false</param-value> 
    </context-param> 
    <context-param> 
     <param-name>facelets.VIEW_MAPPINGS</param-name> 
     <param-value>*.xhtml</param-value> 
    </context-param> 
    <context-param> 
     <param-name>facelets.SKIP_COMMENTS</param-name> 
     <param-value>true</param-value> 
    </context-param> 
    <!--End of the configuration part for Facelets--> 

</web-app> 

而我的facelet-config文件

<?xml version="1.0" encoding="UTF-8"?> 
<faces-config version="1.2" 
       xmlns="http://java.sun.com/xml/ns/javaee" 
       xmlns:xi="http://www.w3.org/2001/XInclude" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
     http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"> 
<managed-bean> 
    <description>Managed Bean for HomeContent</description> 
    <managed-bean-name>Sample1</managed-bean-name> 
    <managed-bean-class>com.test.Sample1</managed-bean-class> 
    <managed-bean-scope>session</managed-bean-scope> 
</managed-bean> 

和我Facelet是

<!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:rich="http://richfaces.org/rich" 
    xmlns:a4j="http://richfaces.org/a4j"> 
    <f:view> 
     <head> 
       <title>Facelet Page</title> 
     </head> 
     <body> 
      <h:form id="sampleForm" binding="#{Sample1.initForm}">    
       <rich:panel> 
        <a4j:outputPanel id="sampleOutputPanel"> 

         <h:outputText value="UserName : "/> 
         <h:inputText value="#{Sample1.username}"/> 

         <a4j:commandButton value="Test" 
          reRender="sampleOutputPanel,output" 
          action="#{Sample1.displayButtonAction}"/> 

         <h:outputText id="output" 
     value="Typed username : #{Sample1.displayValue}"/> 
        </a4j:outputPanel> 
       </rich:panel> 
      </h:form> 
     </body> 
    </f:view> 
</html> 

當我運行我的facelet時,會提示文件下載選項。 我無法看到facelet文件。任何人都可以告訴文件中的錯誤嗎?

回答

0

使用tomcat 7.x版本和RIchfaces 4.x版本它工作。意識到這是由於版本不匹配。