【问题标题】:problem with primefaces scheduleprimefaces时间表的问题
【发布时间】:2010-08-29 12:11:33
【问题描述】:

我尝试编写一个包含调度程序的简单页面

看起来不错,但听众喜欢

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>

我的背豆是:

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;
   }
}

【问题讨论】:

    标签: java jsp jsf primefaces


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:

      &lt;p:resources/&gt; 应该放在&lt;head&gt; 中。查看User Guide的第2.3章。

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

      【讨论】:

      • 谢谢,更改 位置没有帮助!我曾尝试使用 faceclet,但没有成功!你能回答我的帖子吗? stackoverflow.com/questions/3598738/how-to-make-facelet-work 谢谢
      • 感谢 facelet 的工作。但它不显示事件!上面的问题也没有解决!
      • 您使用的是 JSF 1.2 还是 2.0?我的印象是您使用的是 JSF 1.2 并且正在阅读针对 JSF 2.0 的指南/教程,这会导致所有问题和混乱。如果您的 servletcontainer 有能力,我建议您使用 JSF 2.0。
      • 我正在使用 myfaces api 1.2.7。我不能使用 JSF2.0,如何在我的配置中使用这个组件?有具体的教程吗?
      • 哦,这是 MyFaces 1.2?好的.. 你为什么不能选择 JSF 2.0?好吧,毕竟您需要仔细阅读 PrimeFaces 指南和其他地方的 JSF 1.2 特定说明。抱歉,我无法提供更多帮助,因为我无法从头顶告诉 PrimeFaces 2 + JSF 1.2 应该如何协同工作。在未来的问题中,我强烈建议提及 JSF impl/version 用于避免问题/答案中的混淆和红鲱鱼。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-12-31
      • 1970-01-01
      • 1970-01-01
      • 2012-08-03
      • 2012-11-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多