我正在使用p:schedule但是在我第一次进入页面时它不会显示
我必须刷新页面一次然后它就会出来。
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:form id="form">
<h:outputScript library="js" name="primefaces-locale-zh.js" />
<div class="top-extra-title">
<h:outputText value="#{menu.miMeetingScheduleView}" />
</div>
<p:schedule id="schedule" value="#{meetingScheduleView.meetingSchedule}"
widgetVar="meetingSchedule" timeZone="GMT+8" draggable="false"
locale="zh" >
<p:ajax partialSubmit="true" event="eventSelect" listener="#{meetingScheduleView.onEventSelect}"
update="mform :content" />
</p:schedule>
</h:form>
</ui:composition>
@ManagedBean(name = "meetingScheduleView")
@ViewScoped
public class MeetingScheduleView implements Serializable {
private static final long serialVersionUID = 1L;
SessionUser sessionUser;
private String accountOrgId;
private static final String msgFile = "cyberstar.module.meeting.meeting";
private List<Meeting> meetingList;
private ScheduleModel meetingSchedule;
private ScheduleEvent event;
@ManagedProperty(value = "#{sysAdminPage}")
private SysAdminPage sysAdminPage;
@PostConstruct
public void init() {
sessionUser = JSFUtil.getSessionUser();
if(sessionUser==null){
MsgUtil.showErrorMsg(msgFile, "infSessionUserFail", "infSessionUserFailDetail");
sessionUser.logoff();
}
accountOrgId = sessionUser.getOperator().getOrgId();
meetingList = new ArrayList<Meeting>();
meetingSchedule = new DefaultScheduleModel();
event = new DefaultScheduleEvent();
initialize();
}
public void sendMeetingUnid(){
ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
String issueUnid = context.getRequestParameterMap().get("meetingUnid");
LinkedHashMap<String , String> hm = new LinkedHashMap<String , String>();
if (sessionUser.getSendDataMap().get("meetingView") == null) {
hm.put("meetingUnid", issueUnid);
sessionUser.getSendDataMap().put("meetingView", hm);
} else {
hm = sessionUser.getSendDataMap().get("meetingView");
hm.put("meetingUnid", issueUnid);
}
}
public void initialize(){
try {
if (sessionUser.isCyberStar()) {
meetingList = MeetingDAO.getAllMeeting();
} else {
meetingList = MeetingDAO.getMeetingByOrgId(accountOrgId);
}
for (int i = 0; i < meetingList.size(); i++) {
Meeting m = meetingList.get(i);
if (m.getStatus().equals(MeetingStatus.sketch)) {
continue;
}
DefaultScheduleEvent dsEvent = new DefaultScheduleEvent(m.getTitle(), m.getStartTime(), m.getEndTime(),m.getUnid());
if(m.getStatus().equals(MeetingStatus.cancel)){
dsEvent.setStyleClass("redEvent");
}
meetingSchedule.addEvent(dsEvent);
}
} catch (SQLException e) {
MsgUtil.showErrorMsg(msgFile, "infUpdateFail",
"infUpdateFailSQLExceptionDetail");
e.printStackTrace();
}
}
public void onEventSelect(SelectEvent selectEvent) {
event = (ScheduleEvent) selectEvent.getObject();
String issueUnid = String.valueOf(event.getData());
LinkedHashMap<String , String> hm = new LinkedHashMap<String , String>();
if (sessionUser.getSendDataMap().get("meetingView") == null) {
hm.put("meetingUnid", issueUnid);
sessionUser.getSendDataMap().put("meetingView", hm);
} else {
hm = sessionUser.getSendDataMap().get("meetingView");
hm.put("meetingUnid", issueUnid);
}
try {
sysAdminPage.openView("meetingForm");
} catch (IOException e) {
MsgUtil.showErrorMsg(msgFile, "infUpdateFail", "infUpdateFailExceptionDetail");
e.printStackTrace();
}
}
这些是指向页面的按钮代码
<p:menuitem value="#{menu.miMeetingScheduleView}" styleClass="meetingScheduleView"
onclick="highlightme('meetingScheduleView')" action="#{sysAdminPage.menuSelected}"
update="mform :content">
<f:param name="viewname" value="meetingScheduleView" />
</p:menuitem>
我的目标是在我进入页面时显示p:schedule