2010-08-29 48 views
0

我试图写一个包含调度问题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; 
    } 
} 

回答

0

<p:resources/>被前人的精力放在里面<head>。检查User Guide的章节2.3。

与问题无关,我强烈建议放弃JSP并使用其后继的Facelets。

+0

谢谢,改变的位置并没有帮助! 我试图使用faceclet,但我没有成功! 你能回答我的文章吗? http://stackoverflow.com/questions/3598738/how-to-make-facelet-work 谢谢 – arash 2010-08-30 09:24:52

+0

谢谢你现在facelet的作品。但它不显示事件!以上问题也没有解决! – arash 2010-08-30 11:50:24

+0

你使用的是JSF 1.2还是2.0?我的印象是你使用的是JSF 1.2,并且正在阅读针对JSF 2.0的准则/教程,这会导致所有问题和困惑。如果你的servletcontainer能够胜任,我推荐使用JSF 2.0。 – BalusC 2010-08-30 11:58:44

1

我有一个类似的问题,我的事件没有显示出来。事实证明,我嵌套了form和outputLabel元素,不允许计划正确呈现。我不知道为什么,但是一旦我最小化了嵌套,它就表现得很好。把它丢去外面。