fullCalendar制作一款简单的日历日程

阅读更多
//说什么都没有例子直观,这是个比较简单的日历日程,附件为效果图、代码效果和需要引用的js与css文件
package com.kinth.oa.daily.action;

import java.io.IOException;
import java.net.URLDecoder;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.sf.json.JSONArray;
import net.sf.json.JsonConfig;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.gdcn.bpaf.common.base.BaseStrutsAction;
import com.gdcn.bpaf.common.helper.BeanUtil;
import com.gdcn.bpaf.common.helper.WebHelper;
import com.gdcn.bpaf.common.taglib.SplitPage;
import com.gdcn.bpaf.security.model.LogonVO;
import com.kinth.common.helper.GUIDHelper;
import com.kinth.common.helper.PagerList;
import com.kinth.oa.daily.action.form.PerScheduleCategoryForm;
import com.kinth.oa.daily.action.form.PerScheduleForm;
import com.kinth.oa.daily.model.PerSchedule;
import com.kinth.oa.daily.model.PerScheduleCategory;
import com.kinth.oa.daily.service.IPerScheduleService;
import com.kinth.oa.official.helper.JsonDateValueProcessor;
/**
 * 

Title 个人日程action

*

Copyright: Copyright (c) 2012

*

@date : 2012-10-1 */ public class PerScheduleAction extends BaseStrutsAction{ private IPerScheduleService perscheduleService; /** * 以月历模式查看个人日程 * @param mapping * @param form * @param request * @param response * @return ActionForward */ public ActionForward toJson(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException { response.setCharacterEncoding("utf-8"); String userId=WebHelper.getLogon(request).getLogonid(); String userName=WebHelper.getLogon(request).getUsername(); String hql = "FROM PerSchedule a where a.userId = "+"'"+userId+"'"; List list=perscheduleService.queryPerSchedules(hql); //移除同一天的日程事件 for (int i=0;i i; j--) { if (list.get(j).getStartTime().toString().substring(0, 10).equals(list.get(i).getStartTime().toString().substring(0, 10))) { list.remove(j); } } } SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String str = list.get(i).getStartTime().toString().substring(0, 19); try { list.get(i).setStartTime(sf.parse(str)); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } } JSONArray json = JSONArray.fromObject(list); String resultStr = json.toString(); try { response.getWriter().write(resultStr); response.getWriter().flush(); response.getWriter().close(); } catch (IOException e) { e.printStackTrace(); } return null; } @SuppressWarnings("unchecked") protected void writeJSON(HttpServletRequest request,HttpServletResponse response,Map map)throws Exception{ //获得json的配置 JsonConfig config=new JsonConfig(); //设置javabean中日期转换时的格式 config.registerJsonValueProcessor(Date.class, new JsonDateValueProcessor("yyyy-MM-dd HH:mm:ss")); Object o = JSONArray.fromObject(map,config); String result = o==null?"":o.toString(); response.setContentType("application/json;charset=UTF-8"); response.setCharacterEncoding("utf-8"); response.setHeader("Charset", "utf-8"); response.setHeader("Cache-Control", "no-cache"); response.getWriter().print(result); } public IPerScheduleService getPerscheduleService() { return perscheduleService; } public void setPerscheduleService(IPerScheduleService perscheduleService) { this.perscheduleService = perscheduleService; } }

 

<%@ page contentType="text/html; charset=GBK" language="java"%>
<%@ page isELIgnored="false"%>





日常业务-个人日程
	日程
	





	

 
 



 

  

  • fullCalendar制作一款简单的日历日程_第1张图片
  • 大小: 84.6 KB
  • fullCalendar制作一款简单的日历日程_第2张图片
  • 大小: 22.5 KB
  • fullCalendar代码文件.zip (3.7 KB)
  • 下载次数: 332
  • 要引入的源码文件.zip (214.2 KB)
  • 下载次数: 277
  • 查看图片附件

你可能感兴趣的:(日历,日程,fullCalendar,谷歌日历)