将内容加载到Primefaces Schedule中

时间:2013-04-16 20:21:12

标签: java jsf primefaces

我希望有一个时间表,所有用户都可以互相留下“公开”消息。这是我日程安排的xhtml

<ui:define name="content">
    <div id="dashboardMain">
        <h:form id="form">  

            <p:growl id="messages" showDetail="true" />  

            <p:schedule id="schedule" value="#{scheduleManager.eventModel}" widgetVar="myschedule" aspectRatio="2" showWeekends="false" rightHeaderTemplate="false">  
                <p:ajax event="dateSelect" listener="#{scheduleManager.onDateSelect}" update="eventDetails" oncomplete="eventDialog.show()" />  
                <p:ajax event="eventSelect" listener="#{scheduleManager.onEventSelect}" update="eventDetails" oncomplete="eventDialog.show()" />  
            </p:schedule>  

            <p:dialog widgetVar="eventDialog" header="#{msg['title.eventDetails']}" showEffect="clip" hideEffect="clip">  
                <h:panelGrid id="eventDetails">
                    <p:row>  
                        <p:inputTextarea id="title" value="#{scheduleManager.event.title}" required="true" cols="40" rows="5" maxlength="100"/>
                    </p:row>  

                    <p:row>
                    <p:commandButton id="addButton" value="Save" process="@form" actionListener="#{scheduleManager.addEvent}" oncomplete="myschedule.update();eventDialog.hide();"/>  
                    <p:commandButton id="deleteButton" value="Delete" process="@form" actionListener="#{scheduleManager.deleteEvent}" oncomplete="myschedule.update();eventDialog.hide();"/>
                    </p:row>  
                </h:panelGrid>  
            </p:dialog>  
        </h:form>  
    </div>
</ui:define>

以下是每次有人在日程表中添加新消息时保存在数据库中的实体消息

@Entity(name = "schedule_message")
public class ScheduleMessage {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "schedule_message_id")
    private Integer scheduleMessageId;

    @Column(name = "start_date")
    private Date startDate;

    @Column(name = "end_date")
    private Date endDate;

    @Column
    private String message;

    public Integer getScheduleMessageId() {
        return scheduleMessageId;
    }

    public void setScheduleMessageId(Integer schedulerMessageId) {
        this.scheduleMessageId = schedulerMessageId;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}

邮件存储正常。问题是我不知道如何加载它们。 现在,我的问题是:如何加载所有scheduleMessages(每个包含id,startDate,endDate和实际消息)并在p:schedule中显示它们?

0 个答案:

没有答案