0

我在 Eclipse 开普勒上使用 primefaces4.0 和 glassfish4 和 java ee7。
我对其进行了配置(将主题和primefaces的jar放在lib和java builpath和类变量上,并将其添加<htm>到web.xml中)但组件根本没有出现。这是我的代码

    <!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:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
 xmlns:p="http://primefaces.org/ui">
    <h:head>
     <meta charset="windows-1256"></meta>
      <title>Connexion</title>
     </h:head>
     <h:body>
      <h:form>
      <fieldset> 
      <p:outputLabel for="email">Adresse email <span class="requis"></span>     </p:outputLabel>    
            <p:inputText id="email" value="" required="true" size="20" maxlength="60"  />
      <p:message id="emailMessage" for="email" errorClass="erreur" />
      <br/>  
       <p:outputLabel for="motdepasse">Mot de passe <span class="requis"></span></p:outputLabel>
      <p:inputSecret id="motdepasse" value="" required="true" size="20" maxlength="20"                       />
        <p:message id="motDePasseMessage" for="motdepasse"
            errorClass="erreur" />
        <br />
        <p:commandButton value="Connexion" action="" ajax="false" />
        </fieldset>
        </h:form>

                    </h:body>
                    </html>

这是我的 web.xml 文件

        <?xml version="1.0" encoding="UTF-8"?>
        <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xmlns="http://xmlns.jcp.org/xml/ns/javaee" 
        xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee       http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" 
id="WebApp_ID" version="3.1"
        >
        <display-name>Portail</display-name>
        <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        </welcome-file-list>
         <context-param>
         <param-name>primefaces.THEME</param-name>
         <param-value>bootstrap</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>*.xhtml</url-pattern>
         </servlet-mapping>

        </web-app>
4

2 回答 2

2

您的文件名是index.html,但在您的 web.xml 中,您指定只想渲染以.xhtml. 将您的文件重命名为index.xhtml

于 2013-11-14T10:30:10.640 回答
0

I figured out why the components wasn't rendring after reading this post No TagLibrary associated to PrimeFaces's namespace.

I did put the jar in the lib but i didn't deploy them correctly that's why the tags weren't doing their work . I repeated the configuration this time with more attention and it finally worked.

于 2013-11-16T23:43:32.623 回答