1

我有一个 jsf 项目,我只使用 core 和 html jsf taglibs,但是表单的组件看起来很糟糕,所以我现在正在尝试添加richfaces,这样我就可以为它们添加皮肤,我添加的罐子对于richfaces是:

  • richfaces-core-api-4.3.4.Final.jar
  • richfaces-core-impl-4.3.4.Final.jar
  • richfaces-components-api-4.3.4.Final.jar
  • richfaces-components-ui-4.3.4.Final.jar
  • cssparser-0.9.5.jar
  • 番石榴-r09.jar
  • sac-1.3.sources,jar

我的 web.xml 看起来像这样

 <servlet>
      <servlet-name>FacesServlet</servlet-name>
      <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
      <load-on-startup>1</load-on-startup>
      </servlet>
 <servlet-mapping>
  <servlet-name>FacesServlet</servlet-name>
  <url-pattern>*.xhtml</url-pattern>
 </servlet-mapping>

 <filter>  
     <!-- Nome que indentifica o filtro pode ser qualquer um -->
    <filter-name>LoginWard</filter-name> 
    <!-- Endereço da classe que herda de javax.servlet.Filter com o nome dos pacotes e sem .java ex: org.otkdrg.NomeDaClasse --> 
    <filter-class>br.com.gbcCalcados.moduloVendas.filter.LoginWard</filter-class>  
</filter> 
<filter-mapping>  
    <filter-name>LoginWard</filter-name>  
    <url-pattern>*.xhtml</url-pattern>  
</filter-mapping>  

<context-param>  
<param-name>org.richfaces.CONTROL_SKINNING</param-name>  
<param-value>enable</param-value>  
</context-param>  

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

当我运行项目时,仍然没有任何反应,甚至没有例外。

这是一个页面

<!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"
      >

    <ui:composition template="/WEB-INF/templates/gbcTemplate.xhtml" 
     xmlns:rich="http://richfaces.org/rich"  
      xmlns:a4j="http://richfaces.org/a4j" >
        <ui:define name="Conteudo">
        <div id="funcFormDiv" align="center">
            <h:form>
            <h:messages/>
                <h:outputLabel for="campoNome" value="Nome Completo:"/><br/>    
                <h:inputText id="campoNome" required="true" value="#{cadastroFuncBean.nomeCompleto}" validatorMessage="O nome completo é composto de um ou mais nomes e não pode conter numeros" requiredMessage="O nome completo é obrigatorio" >
                 <f:validateRegex pattern="\D* \D*"/>
                </h:inputText><br/>

                <h:outputLabel for="campoUsuario" value="Nome de usuário:"/><br/>   
                <h:inputText id="campoUsuario" required="true" value="#{cadastroFuncBean.usuario}" requiredMessage="O nome de usuario é obrigatorio" validatorMessage="O nome de usuário deve conter no minimo 6 e no maximo 15 letras">
                    <f:validateLength minimum="6" maximum="15"/>
                </h:inputText><br/>

                <h:outputLabel for="campoSenha" value="Senha:"/><br/>   
                <h:inputSecret id="campoSenha" required="true" value="#{cadastroFuncBean.senha}" requiredMessage="A senha é obrigatoria" validatorMessage="A senha deve conter no minimo 3 e no maximo 10 letras">
                    <f:validateLength minimum="3" maximum="10"/>
                </h:inputSecret><br/>

                <h:outputLabel for="campoNumContrato" value="Numero do contrato:"/><br/>    
                <h:inputText id="campoNumContrato" required="true" value="#{cadastroFuncBean.numContrato}" requiredMessage="O numero de contrato é obrigatorio" validatorMessage="Numero de contrato invalido">
                    <f:validateRegex pattern="^9\d{5}"/>

                </h:inputText><br/><br/><br/>
                <h:commandButton value="Enviar" action="#{cadastroFuncBean.cadastrar}"  /><input type="reset" value="Resetar" />
                <br/>
                <h:button id="voltar" value="Voltar para Login" outcome="login" />


            </h:form>
        </div>
        </ui:define>
    </ui:composition>
</html>

模板:

<?xml version="1.0" encoding="UTF-8"?>
<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:rich="http://richfaces.org/rich"  
      xmlns:a4j="http://richfaces.org/a4j"  >

<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>GBC calçados</title>
<h:outputStylesheet name="arquivo.css" library="css"/>
</h:head>

<h:body>
<div id="LoginInfoTab"><span id="LoginInfo">Usuário Logado:<h:outputText value="#{sessionScope['usuario_logado'] }"  /></span></div>
<div id="TopBanner"><h:graphicImage width="100%" library="images" name="TopBanner.jpg" /></div>

<div id="Menu" >
<h:form>
   <h:link outcome="clientesHome">
    <div class="menuItem">
        <span class="menuItemTexto">Clientes</span>
    </div>
   </h:link>
   <h:link outcome="vendasHome" >
    <div class="menuItem" id="botaoVendas">
        <span class="menuItemTexto">Vendas</span>
    </div>
   </h:link>

</h:form>
</div>

<div id="Content" align="center">
    <ui:insert name ="Conteudo"/>
</div>
<div id="BottomBanner"><h:graphicImage width="100%" library="images" name="BottomBanner.jpg" /></div>




</h:body>
</html>
4

0 回答 0