日历按钮没有显示在jsf代码的结果页上

Calendar button not shown on result page of jsf code

本文关键字:代码 结果 jsf 按钮 显示 日历      更新时间:2023-09-26

我是一个新的JSF学习者。我试图实现一个示例日历函数,但在运行xhtml页面后无法获得日历按钮。谁能告诉我同样的原因?

<!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:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://xmlns.jcp.org/jsf/html"
    xmlns:a="http://xmlns.jcp.org/jsf/passthrough"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:a4j="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich">
<h:head>
    <title>Date and Time Picker</title>
</h:head>
<h:body>
    <h:form>
        Name : <h:inputText id="name" value="#{datePicker.name}"  
        a:placeholder="What's your name" />
        Date : <h:inputText id="date" value="#{datePicker.myDate}"  
        a:placeholder="What's your DOB" />  
        <rich:calendar value="#{datePicker.myDate}" id="myDate" popup="false"  datePattern="d/M/yy HH:mm"  buttonLabel="OpenCalendar" 
                cellWidth="24px" cellHeight="22px" />
            <br/>
        <h:commandButton value="Submit" action="response" />

    </h:form>
</h:body>
</html>

RichFaces库添加到项目后,有必要在项目web.xml文件中注册它们。在web.xml中添加以下行:

<!-- Plugging the "Blue Sky" skin into the project -->
<context-param>
   <param-name>org.richfaces.SKIN</param-name>
   <param-value>blueSky</param-value>
</context-param>

<!-- Making the RichFaces skin spread to standard HTML controls -->
<context-param>
      <param-name>org.richfaces.CONTROL_SKINNING</param-name>
      <param-value>enable</param-value>
</context-param>

<!-- Defining and mapping the RichFaces filter -->
<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>