我試圖寫一個包含調度問題primefaces時間表
一個簡單的頁面,它看起來不錯,但像
eventSelectListener,dateSelectListener,eventMoveListener聽衆從未被解僱了!
是什麼問題
這是我的代碼:
<%@ page language="java" pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<%@taglib uri="http://primefaces.prime.com.tr/ui" prefix="p"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSF 'Calendar.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<f:view>
<p:resources/>
<h:form>
<p:schedule value="#{ScheduleBean.model}" editable="true" aspectRatio="4"
eventSelectListener="#{ScheduleBean.onEventSelect}"
dateSelectListener="#{ScheduleBean.onDateSelect}"
eventMoveListener="#{ScheduleBean.onEventMove}"
>
</p:schedule>
</h:form>
</f:view>
</body>
</html>
和我的背bean是:
package com.pardis.calendar.model;
import java.util.HashMap;
import java.util.List;
import javax.annotation.PostConstruct;
import org.primefaces.event.DateSelectEvent;
import org.primefaces.event.ScheduleEntryMoveEvent;
import org.primefaces.event.ScheduleEntrySelectEvent;
import org.primefaces.model.DefaultScheduleModel;
import org.primefaces.model.ScheduleModel;
import com.fanava.genericmanagedbeans.utls.ManagedBeanUtils;
import com.pardis.calendar.dm.calendar.CalendarBean;
import com.pardis.calendar.dm.user.UserBean;
public class ScheduleBean {
private ScheduleModel model;
private int userId;
private int systemId;
public int getSystemId() {
return 1;
}
public void setSystemId(int systemId) {
this.systemId = systemId;
}
public ScheduleBean() {
model = new DefaultScheduleModel();
}
@PostConstruct
public void Initialize() {
...
}
public void onEventSelect(ScheduleEntrySelectEvent selectEvent){
System.out.println("done");
}
public void onDateSelect(DateSelectEvent selectEvent) {
System.out.println("done");
}
public void onEventMove(ScheduleEntryMoveEvent selectEvent) {
System.out.println("move");
}
public ScheduleModel getModel() {
return model;
}
public int getUserId() {
return 1;
}
public void setUserId(int userId) {
this.userId = userId;
}
}
謝謝,改變
的位置並沒有幫助! 我試圖使用faceclet,但我沒有成功! 你能回答我的文章嗎? http://stackoverflow.com/questions/3598738/how-to-make-facelet-work 謝謝 – arash 2010-08-30 09:24:52
謝謝你現在facelet的作品。但它不顯示事件!以上問題也沒有解決! – arash 2010-08-30 11:50:24
你使用的是JSF 1.2還是2.0?我的印象是你使用的是JSF 1.2,並且正在閱讀針對JSF 2.0的準則/教程,這會導致所有問題和困惑。如果你的servletcontainer能夠勝任,我推薦使用JSF 2.0。 – BalusC 2010-08-30 11:58:44