title: Schedule with primefaces
body: <p>I am trying do the example of this page:
  <a href="http://www.primefaces.org/showcase/ui/schedule.jsf" rel="nofollow">http://www.primefaces.org/showcase/ui/schedule.jsf</a></p>
  
  <p>I have the xhtml page like:, that is the same that in the example, but i call the page: index.xhtml: </p>
  
  <pre><code>    &lt;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:p="http://primefaces.org/ui"&gt;
  
      &lt;h:form id="form"&gt;
  
          &lt;p:growl id="messages" showDetail="true" /&gt;
  
          &lt;p:schedule id="schedule" value="#{scheduleController.eventModel}" widgetVar="myschedule"&gt;
  
              &lt;p:ajax event="dateSelect" listener="#{scheduleController.onDateSelect}" update="eventDetails" oncomplete="PF('eventDialog').show()" /&gt;
              &lt;p:ajax event="eventSelect" listener="#{scheduleController.onEventSelect}" update="eventDetails" oncomplete="PF('eventDialog').show()" /&gt;
              &lt;p:ajax event="eventMove" listener="#{scheduleController.onEventMove}" update="messages" /&gt;
              &lt;p:ajax event="eventResize" listener="#{scheduleController.onEventResize}" update="messages" /&gt;
  
          &lt;/p:schedule&gt;
  
          &lt;p:dialog widgetVar="eventDialog" header="Event Details" showEffect="clip" hideEffect="clip"&gt;
              &lt;h:panelGrid id="eventDetails" columns="2"&gt;
                  &lt;h:outputLabel for="title" value="Title:" /&gt;
                  &lt;p:inputText id="title" value="#{scheduleController.event.title}" required="true"/&gt;
  
                  &lt;h:outputLabel for="from" value="From:" /&gt;
                  &lt;p:inputMask id="from" value="#{scheduleController.event.startDate}" mask="99/99/9999"&gt;
                      &lt;f:convertDateTime pattern="dd/MM/yyyy" /&gt;
                  &lt;/p:inputMask&gt;
  
                  &lt;h:outputLabel for="to" value="To:" /&gt;
                  &lt;p:inputMask id="to" value="#{scheduleController.event.endDate}" mask="99/99/9999"&gt;
                      &lt;f:convertDateTime pattern="dd/MM/yyyy" /&gt;
                  &lt;/p:inputMask&gt;
  
                  &lt;h:outputLabel for="allDay" value="All Day:" /&gt;
                  &lt;h:selectBooleanCheckbox id="allDay" value="#{scheduleController.event.allDay}" /&gt;
  
                  &lt;p:commandButton type="reset" value="Reset" /&gt;
                  &lt;p:commandButton id="addButton" value="Save" actionListener="#{scheduleController.addEvent}" oncomplete="PF('myschedule').update();PF('eventDialog').hide();"/&gt;
              &lt;/h:panelGrid&gt;
          &lt;/p:dialog&gt;
  
      &lt;/h:form&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>And now i have in the Java class:</p>
  
  <pre><code>public class ScheduleController implements Serializable {
  
  private ScheduleModel eventModel;
  private ScheduleEvent event = new DefaultScheduleEvent();
  
  public ScheduleController() {
      eventModel = new DefaultScheduleModel();
      eventModel.addEvent(new DefaultScheduleEvent("Champions League Match", previousDay8Pm(), previousDay11Pm()));
      eventModel.addEvent(new DefaultScheduleEvent("Birthday Party", today1Pm(), today6Pm()));
      eventModel.addEvent(new DefaultScheduleEvent("Breakfast at Tiffanys", nextDay9Am(), nextDay11Am()));
      eventModel.addEvent(new DefaultScheduleEvent("Plant the new garden stuff", theDayAfter3Pm(), fourDaysLater3pm()));
  }
  
  public Date getRandomDate(Date base) {
      Calendar date = Calendar.getInstance();
      date.setTime(base);
      date.add(Calendar.DATE, ((int) (Math.random()*30)) + 1);    //set random day of month
  
      return date.getTime();
  }
  
  
  public Date getInitialDate() {
      Calendar calendar = Calendar.getInstance();
      calendar.set(calendar.get(Calendar.YEAR), Calendar.FEBRUARY, calendar.get(Calendar.DATE), 0, 0, 0);
  
      return calendar.getTime();
  }
  
  public ScheduleModel getEventModel() {
      return eventModel;
  }
  
  private Calendar today() {
      Calendar calendar = Calendar.getInstance();
      calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DATE), 0, 0, 0);
  
      return calendar;
  }
  
  
      private Date previousDay8Pm() {
      Calendar t = (Calendar) today().clone();
      t.set(Calendar.AM_PM, Calendar.PM);
      t.set(Calendar.DATE, t.get(Calendar.DATE) - 1);
      t.set(Calendar.HOUR, 8);
  
      return t.getTime();
  }
  
  private Date previousDay11Pm() {
      Calendar t = (Calendar) today().clone();
      t.set(Calendar.AM_PM, Calendar.PM);
      t.set(Calendar.DATE, t.get(Calendar.DATE) - 1);
      t.set(Calendar.HOUR, 11);
  
      return t.getTime();
  }
  
  private Date today1Pm() {
      Calendar t = (Calendar) today().clone();
      t.set(Calendar.AM_PM, Calendar.PM);
      t.set(Calendar.HOUR, 1);
  
      return t.getTime();
  }
  
  private Date theDayAfter3Pm() {
      Calendar t = (Calendar) today().clone();
      t.set(Calendar.DATE, t.get(Calendar.DATE) + 2);     
      t.set(Calendar.AM_PM, Calendar.PM);
      t.set(Calendar.HOUR, 3);
  
      return t.getTime();
  }
  
  private Date today6Pm() {
      Calendar t = (Calendar) today().clone(); 
      t.set(Calendar.AM_PM, Calendar.PM);
      t.set(Calendar.HOUR, 6);
  
      return t.getTime();
  }
  
  private Date nextDay9Am() {
      Calendar t = (Calendar) today().clone();
      t.set(Calendar.AM_PM, Calendar.AM);
      t.set(Calendar.DATE, t.get(Calendar.DATE) + 1);
      t.set(Calendar.HOUR, 9);
  
      return t.getTime();
  }
  
  private Date nextDay11Am() {
      Calendar t = (Calendar) today().clone();
      t.set(Calendar.AM_PM, Calendar.AM);
      t.set(Calendar.DATE, t.get(Calendar.DATE) + 1);
      t.set(Calendar.HOUR, 11);
  
      return t.getTime();
  }
  
  private Date fourDaysLater3pm() {
      Calendar t = (Calendar) today().clone(); 
      t.set(Calendar.AM_PM, Calendar.PM);
      t.set(Calendar.DATE, t.get(Calendar.DATE) + 4);
      t.set(Calendar.HOUR, 3);
  
      return t.getTime();
  }
  
      public ScheduleEvent getEvent() {
      return event;
  }
  
  public void setEvent(ScheduleEvent event) {
      this.event = event;
  }
  
  public void addEvent(ActionEvent actionEvent) {
      if(event.getId() == null)
          eventModel.addEvent(event);
      else
          eventModel.updateEvent(event);
  
      event = new DefaultScheduleEvent();
  }
  
  public void onEventSelect(SelectEvent selectEvent) {
      event = (ScheduleEvent) selectEvent.getObject();
  }
  
  public void onDateSelect(SelectEvent selectEvent) {
      event = new DefaultScheduleEvent("", (Date) selectEvent.getObject(), (Date) selectEvent.getObject());
  }
  
  public void onEventMove(ScheduleEntryMoveEvent event) {
      FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Event moved", "Day delta:" + event.getDayDelta() + ", Minute delta:" + event.getMinuteDelta());
  
      addMessage(message);
  }
  
  public void onEventResize(ScheduleEntryResizeEvent event) {
      FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Event resized", "Day delta:" + event.getDayDelta() + ", Minute delta:" + event.getMinuteDelta());
  
      addMessage(message);
  }
  
  private void addMessage(FacesMessage message) {
      FacesContext.getCurrentInstance().addMessage(null, message);
  }
  
  }
  </code></pre>
  
  <p>That is the same too, that in the example in the page of primefaces.</p>
  
  <p>But the problem is that when i run the project my index.xhtml page is empry, not appear the schedule, and i do not know what happen?</p>
  
  <p>If somebody can help me, </p>
  
  <p>thanks</p>
  
  <p>My Web xml is:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app version="3.0" 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_3_0.xsd"&gt;
  
  &lt;listener&gt;
      &lt;listener-class&gt;com.sun.faces.config.ConfigureListener&lt;/listener-class&gt;
  &lt;/listener&gt;
  
  &lt;servlet&gt;
      &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;javax.faces.webapp.FacesServlet&lt;/servlet-class&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  
  &lt;servlet-mapping&gt;
  
      &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
  
      &lt;url-pattern&gt;*.jsf&lt;/url-pattern&gt;
  
  &lt;/servlet-mapping&gt;
  &lt;welcome-file-list&gt;
      &lt;welcome-file&gt;index.xhtml&lt;/welcome-file&gt;
  &lt;/welcome-file-list&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>And my Faces-config.xml is:</p>
  
  <pre><code>&lt;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"&gt;
  
  &lt;managed-bean&gt;
    &lt;description&gt;UsernName Bean&lt;/description&gt;
    &lt;managed-bean-name&gt;user&lt;/managed-bean-name&gt;
    &lt;managed-bean-class&gt;demo.user&lt;/managed-bean-class&gt;
    &lt;managed-bean-scope&gt;request&lt;/managed-bean-scope&gt;
    &lt;managed-property&gt;
       &lt;property-name&gt;name&lt;/property-name&gt;
       &lt;property-class&gt;java.lang.String&lt;/property-class&gt;
       &lt;value/&gt;
    &lt;/managed-property&gt;
  </code></pre>
  
  <p>
      </p>