Je suis un nouvel apprenant de JSF. J'essaie d'implémenter un exemple de fonction de calendrier, mais je ne parviens pas à obtenir le bouton de calendrier après avoir exécuté la page xhtml. Quelqu'un pourrait-il me dire pourquoi?
<!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>
Réponses:
0 pour la réponse № 1Une fois les bibliothèques RichFaces ajoutées au projet, il est nécessaire de les enregistrer dans le fichier project web.xml. Ajoutez les lignes suivantes dans 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>