精华内容
下载资源
问答
  • JAVA日期控件

    2016-12-01 17:27:04
    web项目,前台时间控件
  • 联动插件联动插件联动插件联动插件联动插件联动插件联动插件联动插件
  • java script 的日期控件

    千次阅读 2009-10-09 17:23:00
    " </td><td align=center>今天' style='width: 50' title='当前日期 快捷键:T'"+ " onclick=/"parent.returnDate(new Date().getDate() +'/'+ (new Date().getMonth() +1) +'/'+ new Date().getFullYear())/">...

    calendar.js

    ***********************

    **********************

    **********分割线********

    **********************

    calendar.html

    **********************

     

    展开全文
  • Java制作的日期选择控件,经测试没有问题,主要包括以下类:主类:CDateComponent 提供二个方法: getSelectedDateByString():以字符串的形式返回选择的日期 getSelectedDate():以java.util.Date的形式返回选择...

     Java制作的日期选择控件,经测试没有问题,主要包括以下类:

    主类:CDateComponent

               提供二个方法:

                getSelectedDateByString():以字符串的形式返回选择的日期

                getSelectedDate():以java.util.Date的形式返回选择的日期

    内部类:DateComponent,日期选择窗口

                   YearAndMonthPanel,选择年和月份面板

                   WeekPanel,星期显示面板

                   DayPanel,日选择面板

                   Handler,处理鼠标点击事件,显示日期选择窗口

    运行效果如下:

                

    程序代码如下:          

    import  javax.swing. * ;
    import  java.util.Date;
    import  java.util.Calendar;
    import  java.text.DateFormat;
    import  java.awt.event. * ;
    import  java.awt. * ;

    /**
     * Created by IntelliJ IDEA.
     * User: cxwu
     * Date: 2007-12-13
     * Time: 21:50:20
     * To change this template use File | Settings | File Templates.
     
    */

    public   class  CDateComponent  extends  JPanel {
        
    private JTextField txtShow;
        
    private boolean isShow = false//do the DataComponent display?
        private JComboBox cbxYear;
        
    private JComboBox cbxMonth;
        
    private DayPanel dp;
        
    private DateComponent dc;//DateComponent view for user selecting date
        public CDateComponent(){
            txtShow 
    = new JTextField(15);
            Icon icon 
    = new ImageIcon("src/images/calendar.gif");
            JLabel lblIcon 
    = new JLabel(icon);
            add(txtShow);
            add(lblIcon);
            lblIcon.addMouseListener(
    new Handler());
            setBorder(BorderFactory.createRaisedBevelBorder());
        }

        
    //get the user selected date by java.lang.String
        public String getSelectedDateByString(){
            
    return txtShow.getText().trim();
        }

        
    //get the user selected date by java.util.Date
        public Date getSelectedDate(){
            DateFormat df 
    = DateFormat.getDateInstance();
            Date date 
    = new Date();
            
    try{
                date 
    = df.parse(getSelectedDateByString());
            }
    catch(Exception e){
                System.out.println(
    "日期的格式不对!");
            }

            
    return date;
        }

        
    //handler mouse event on txtShow,to show the DateComponent view on screen
        class Handler extends MouseAdapter{
            
    public void mousePressed(MouseEvent e) {
                
    if(!isShow){
                    isShow 
    = true;
                    Point pt 
    = e.getPoint();
                    SwingUtilities.convertPointToScreen(pt,(JLabel)e.getSource());
                    Dimension screen 
    = getToolkit().getScreenSize();
                    dc 
    = new DateComponent();
                    
    //decided the position of the DateComponent view
                    int x = pt.x + 5;
                    
    int y = pt.y + 5;
                    
    int w = 360;
                    
    int h = 230;
                    
    if(screen.getWidth() < (x + w) && screen.getHeight() < (y + h)){
                        x 
    = x - 360;
                        y 
    = y - 230;
                    }
    else if(screen.getWidth() < (x + w)){
                        x 
    = x - 360;
                    }
    else if(screen.getHeight() < (y + h)){
                        y 
    = y - 230;
                    }

                    dc.setBounds(x,y,w,h);
                    dc.setVisible(
    true);
                }

            }

        }

        
    //supply the Year and the Month list for the user selecting
        class YearAndMonthPanel extends JPanel{
            JButton btnLeftYear;
            JButton btnRightYear;
            JButton btnLeftMonth;
            JButton btnRightMonth;
            
    public YearAndMonthPanel(){
                setLayout(
    new FlowLayout(0,4,0));
                btnLeftYear 
    = new JButton("<<");
                btnRightYear 
    = new JButton(">>");
                btnLeftMonth 
    = new JButton("<<");
                btnRightMonth 
    = new JButton(">>");
                cbxYear 
    = new JComboBox();
                cbxYear.setPreferredSize(
    new Dimension(64,27));
                cbxMonth 
    = new JComboBox();
                cbxMonth.setPreferredSize(
    new Dimension(64,27));
                addYearAndMonth();
                add(btnLeftYear);
                add(cbxYear);
                add(btnRightYear);
                add(btnLeftMonth);
                add(cbxMonth);
                add(btnRightMonth);
                btnLeftYear.addActionListener(
    new ActionListener() {
                    
    public void actionPerformed(ActionEvent e) {
                        
    int index = cbxYear.getSelectedIndex();
                        
    if(index == 0){
                            
    return;
                        }

                        cbxYear.setSelectedIndex(index 
    - 1);
                        updateDayShow();
                    }

                }
    );
                btnRightYear.addActionListener(
    new ActionListener() {
                    
    public void actionPerformed(ActionEvent e) {
                        
    int index = cbxYear.getSelectedIndex();
                        
    if(index == cbxYear.getItemCount() - 1){
                            
    return;
                        }

                        cbxYear.setSelectedIndex(index 
    + 1);
                        updateDayShow();
                    }

                }
    );
                btnLeftMonth.addActionListener(
    new ActionListener() {
                    
    public void actionPerformed(ActionEvent e) {
                        
    int index = cbxMonth.getSelectedIndex();
                        
    if(index == 0){
                            
    return;
                        }

                        cbxMonth.setSelectedIndex(index 
    - 1);
                        updateDayShow();
                    }

                }
    );
                btnRightMonth.addActionListener(
    new ActionListener() {
                    
    public void actionPerformed(ActionEvent e) {
                        
    int index = cbxMonth.getSelectedIndex();
                        
    if(index == 11){
                            
    return;
                        }

                        cbxMonth.setSelectedIndex(index 
    + 1);
                        updateDayShow();
                    }

                }
    );
                cbxYear.addItemListener(
    new ItemListener() {
                    
    public void itemStateChanged(ItemEvent e) {
                        updateDayShow();
                    }

                }
    );
                cbxMonth.addItemListener(
    new ItemListener() {
                    
    public void itemStateChanged(ItemEvent e) {
                        updateDayShow();
                    }

                }
    );
            }

            
    //update the DayPanel according to the selected Year and Month
            private void updateDayShow(){
                Calendar currentDate 
    = Calendar.getInstance();
                currentDate.set(Integer.parseInt((String)cbxYear.getSelectedItem()),
                        Integer.parseInt((String)cbxMonth.getSelectedItem()) 
    - 1,
                        currentDate.get(Calendar.DAY_OF_MONTH));
                dp.updateShow(currentDate);
            }

            
    private void addYearAndMonth(){
                
    for (int i = 1900; i < 2045; i++{
                    cbxYear.addItem(String.valueOf(i));
                }

                
    for (int i = 1; i < 13; i++{
                    cbxMonth.addItem(String.valueOf(i));
                }

                Calendar now 
    = Calendar.getInstance();
                
    //selected the current data defaultly
                cbxYear.setSelectedItem(String.valueOf(now.get(Calendar.YEAR)));
                cbxMonth.setSelectedItem(String.valueOf(now.get(Calendar.MONTH) 
    + 1));
            }


        }

        
    //display week information
        class WeekPanel extends JPanel{
            
    public WeekPanel(){
                JLabel lblSun,lblMon,lblTues,lblWed,lblThur,lblFri,lblSat;
                lblSun 
    = new JLabel("Sun",SwingConstants.CENTER);
                lblMon 
    = new JLabel("Mon",SwingConstants.CENTER);
                lblTues 
    = new JLabel("Tues",SwingConstants.CENTER);
                lblWed 
    = new JLabel("Web",SwingConstants.CENTER);
                lblThur 
    = new JLabel("Thur",SwingConstants.CENTER);
                lblFri 
    = new JLabel("Fri",SwingConstants.CENTER);
                lblSat 
    = new JLabel("Sat",SwingConstants.CENTER);
                lblSun.setForeground(Color.BLUE);
                lblMon.setForeground(Color.BLUE);
                lblTues.setForeground(Color.BLUE);
                lblWed.setForeground(Color.BLUE);
                lblThur.setForeground(Color.BLUE);
                lblFri.setForeground(Color.BLUE);
                lblSat.setForeground(Color.BLUE);
                setLayout(
    new GridLayout(1,7));
                add(lblSun);
                add(lblMon);
                add(lblTues);
                add(lblWed);
                add(lblThur);
                add(lblFri);
                add(lblSat);
                setBorder(BorderFactory.createLineBorder(Color.BLUE));
                setPreferredSize(
    new Dimension(340,25));
            }

        }

        
    //display days of month,according to the month and the year,decided how to list all days
        class DayPanel extends JPanel implements ActionListener{
            JButton[] dayList;
            JButton selectedBtn;
            
    public DayPanel(){
                dayList 
    = new JButton[42];
                setLayout(
    new GridLayout(6,7,0,0));
                
    for (int i = 0; i < dayList.length; i++{
                    dayList[i] 
    = new JButton();
                    add(dayList[i]);
                    dayList[i].setPreferredSize(
    new Dimension(48,25));
                }

                setBorder(BorderFactory.createLineBorder(Color.blue));
                updateShow(Calendar.getInstance());
            }

            
    //update view according to the selected year and month
            public void updateShow(Calendar selectedDate){
                
    for (int i = 0; i < dayList.length; i++{
                    dayList[i].setVisible(
    true);
                    dayList[i].setForeground(Color.BLACK);
                }

                
    int dayOfMonth = selectedDate.get(Calendar.DAY_OF_MONTH);
                selectedDate.set(Calendar.DAY_OF_MONTH,
    1);
                
    int dayOfWeek = selectedDate.get(Calendar.DAY_OF_WEEK);
                
    int[] days = countDay(selectedDate);
                
    int currentDay = 0;
                
    for (int i = 0; i < days.length; i++{
                    
    if(days[i] == 0){
                        dayList[i].setVisible(
    false);
                    }
    else{
                        currentDay
    ++;
                        dayList[i].setText(String.valueOf(currentDay));
                        dayList[i].addActionListener(
    this);
                    }

                }

                dayList[dayOfMonth 
    + dayOfWeek - 2].setForeground(Color.red);
                repaint();
            }

            
    //count the days of the month
            private int[] countDay(Calendar selectedDate){
                
    int[] day = new int[42];
                
    int oldMonth = selectedDate.get(Calendar.MONTH);
                
    int dayOfWeek = selectedDate.get(Calendar.DAY_OF_WEEK);
                
    boolean isNextMonth = true;
                
    int allDay = 0;
                
    while(isNextMonth){
                    selectedDate.add(Calendar.DAY_OF_MONTH,
    1);
                    
    if(oldMonth != selectedDate.get(Calendar.MONTH)){
                        isNextMonth 
    = false;
                    }

                    allDay
    ++;
                }

                
    for(int i = 0;i < allDay;i++){
                    day[dayOfWeek 
    - 1 + i] = 1;
                }

                
    return day;
            }

            
    //show the selected data in txtShow by java.lang.String 
            public void actionPerformed(ActionEvent e) {
                JButton source 
    = (JButton)e.getSource();
                dc.dispose();
                String s 
    = cbxYear.getSelectedItem() + "-"
                        
    + cbxMonth.getSelectedItem() + "-"
                        
    + source.getText().trim();
                txtShow.setText(s);
                isShow 
    = false;
            }

        }

        
    //compose the YearAndMonthPanel,the WeekPanel and the DayPanel into the DateComponent view
        class DateComponent extends JWindow{
            
    public DateComponent(){
                Container c 
    = getContentPane();
                JPanel pnlMain 
    = new JPanel();
                YearAndMonthPanel yamp 
    = new YearAndMonthPanel();
                WeekPanel wp 
    = new WeekPanel();
                dp 
    = new DayPanel();
                pnlMain.add(yamp);
                pnlMain.add(wp);
                pnlMain.add(dp);
                c.add(pnlMain, BorderLayout.CENTER);
                getRootPane().setBorder(BorderFactory.createLineBorder(Color.orange));
                setVisible(
    true);
                pack();
                setAlwaysOnTop(
    true);
            }

        }

    }

    展开全文
  • java web】 fullCalendar日历控件!【精】

    千次阅读 热门讨论 2016-12-05 10:55:18
    最近研究了一下fullCalendar ,后台用的是java spring mvc, 前端是基于ace框架 分享给大家 【增删改查】有实时的下拉框选中,显示条件信息 dao层代码就不写了 都是增删改查,我就写一下 action还有servicede ...

    第一次写博文!


    最近研究了一下fullCalendar  ,后台用的是java spring mvc, 前端是基于ace框架 分享给大家 【增删改查】有实时的下拉框选中,显示条件信息


    dao层代码就不写了 都是增删改查,我就写一下 action还有servicede impl了 还有web前端的

    上代码

    model层代码

    package com.model;
    
    import java.io.Serializable;
    import java.util.Date;
    
    import javax.persistence.Column;
    import javax.persistence.Entity;
    import javax.persistence.GeneratedValue;
    import javax.persistence.Id;
    import javax.persistence.OneToOne;
    import javax.persistence.Table;
    
    /**
     * 专家课程表
     */
    @Entity
    @Table(name = "t_fullCalendar")
    public class FullCalendar implements Serializable {
    
    	private static final long serialVersionUID = 8987284144577508074L;
    
    	@Id
    	@GeneratedValue
    	@Column(name = "id", unique = true, nullable = false)
    	private Integer id;// 主键
    	@Column(name = "title", length = 100, nullable = false)
    	private String title;// 标题;
    	@Column(name = "startDate", length = 100, nullable = false, updatable = false)
    	private String startDate;// 开始时间
    	@Column(name = "endDate", length = 100, nullable = false, updatable = false)
    	private String endDate;// 结束时间
    	@Column(name = "ifAllDay", length = 100, nullable = false)
    	private Boolean ifAllDay;// 是否全天
    	@Column(name = "adminid", length = 100,updatable = false)
    	private Integer adminid;// 用户id
    	@Column(name = "adminName", length = 100,updatable = false)
    	private String adminName;// 用户名字
    	@Column(name = "color", length = 100)
    	private String color;// 颜色状态   1绿色,2灰色,3橙色
    
    	public Integer getId() {
    		return id;
    	}
    
    	public void setId(Integer id) {
    		this.id = id;
    	}
    
    	public String getTitle() {
    		return title;
    	}
    
    	public void setTitle(String title) {
    		this.title = title;
    	}
    
    	public void setIfAllDay(Boolean ifAllDay) {
    		this.ifAllDay = ifAllDay;
    	}
    
    	public String getStartDate() {
    		return startDate;
    	}
    
    	public void setStartDate(String startDate) {
    		this.startDate = startDate;
    	}
    
    	public String getEndDate() {
    		return endDate;
    	}
    
    	public void setEndDate(String endDate) {
    		this.endDate = endDate;
    	}
    
    	public Boolean getIfAllDay() {
    		return ifAllDay;
    	}
    
    	public Integer getAdminid() {
    		return adminid;
    	}
    
    	public void setAdminid(Integer adminid) {
    		this.adminid = adminid;
    	}
    
    	public String getAdminName() {
    		return adminName;
    	}
    
    	public void setAdminName(String adminName) {
    		this.adminName = adminName;
    	}
    	
    	public String getColor() {
    		return color;
    	}
    
    	public void setColor(String color) {
    		this.color = color;
    	}
    
    	public FullCalendar() {
    		super();
    	}
    }
    service层 代码
    package com.service.impl;
    
    import java.util.List;
    
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.stereotype.Service;
    import org.springframework.transaction.annotation.Isolation;
    import org.springframework.transaction.annotation.Propagation;
    import org.springframework.transaction.annotation.Transactional;
    
    import com.dao.ExpertOneselfClientDao;
    import com.model.FullCalendar;
    import com.service.ExpertOneselfClientService;
    import com.service.FullCalendarClientService;
    
    @Service("expertOneselfServiceClient")
    public class IExpertOneselfClientService implements ExpertOneselfClientService {
    	
    	private ExpertOneselfClientDao expertOneselfClientDao;
    	
    	public ExpertOneselfClientDao getExpertOneselfClientDao() {
    		return expertOneselfClientDao;
    	}
    	@Autowired
    	public void setExpertOneselfClientDao(
    			ExpertOneselfClientDao expertOneselfClientDao) {
    		this.expertOneselfClientDao = expertOneselfClientDao;
    	}
    
    	/**
    	 * 添加
    	 */
    	@Transactional(isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED)
    	public String insertCalendar(FullCalendar fullCalendar) {
    		expertOneselfClientDao.insert(fullCalendar);
    		return null;
    	}
    
    	/**
    	 * 修改
    	 */
    	@Transactional(isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED)
    	public String upCalendar(FullCalendar fullCalendar) {
    		expertOneselfClientDao.saveOrUpdate(fullCalendar);
    		return null;
    	}
    
    	/**
    	 * 删除
    	 * @param end 
    	 * @param start 
    	 */
    	@Transactional(isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED)
    	public String delCalendar(String name, String start, String end) {
    		String sql = "delete from FullCalendar where adminName = '"+name+"' and startDate BETWEEN convert(date,'"+start+"') AND convert(date,'"+end+"') AND endDate  BETWEEN convert(date,'"+start+"') AND convert(date,'"+end+"')";
    		expertOneselfClientDao.deleteSql(sql);
    		return null;
    	}
    
    	
    	/**
    	 * 查询专家 根据 用户id
    	 */
    	public List<Object> queryAllById(String start, String end,Integer id) {
    		List<Object> list = null;
    		String hql = "from FullCalendar where adminId="+id+" and startDate BETWEEN convert(date,'"+start+"') AND convert(date,'"+end+"') AND endDate  BETWEEN convert(date,'"+start+"') AND convert(date,'"+end+"')";
    		list = expertOneselfClientDao.query(hql);
    		return list;
    	}
    	/**
    	 * 查询专家
    	 */
    	public List<Object> queryAll(String start, String end, String expertName) {
    		List<Object> list = null;
    		String hql = "from FullCalendar where startDate BETWEEN convert(date,'"+start+"') AND convert(date,'"+end+"') AND endDate  BETWEEN convert(date,'"+start+"') AND convert(date,'"+end+"') AND adminName = '"+expertName+"'";
    		list = expertOneselfClientDao.query(hql);
    		return list;
    	}
    	/**
    	 * 根于id改预约状态
    	 * @param id
    	 * @return
    	 */
    	public void bespeak(String id) {
    		String sql = "update FullCalendar set color = '3' where id = "+id+"";
    		expertOneselfClientDao.updateSql(sql);
    	}
    }
    

    action层代码

    package com.action;
    
    import java.io.IOException;
    import java.text.ParseException;
    import java.text.SimpleDateFormat;
    import java.util.Date;
    import java.util.List;
    
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;
    
    import net.sf.json.JSONArray;
    
    import org.apache.log4j.Logger;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.stereotype.Controller;
    import org.springframework.web.bind.annotation.RequestMapping;
    import org.springframework.web.bind.annotation.RequestMethod;
    import org.springframework.web.bind.annotation.RequestParam;
    
    import com.common.Constants;
    import com.model.FullCalendar;
    import com.service.impl.IExpertOneselfClientService;
    import com.service.impl.ILogTableTableService;
    
    /**
     * 专家日程Client----自己看自己的
     * 
     * @author 裴广庭
     * 
     */
    @Controller
    @RequestMapping(value = "/expertOneselfClient")
    public class ExpertOneselfClientAction {
    
    	private ILogTableTableService logTableTableService;
    	private Logger log = Logger.getLogger(ExpertOneselfClientAction.class);
    
    	private IExpertOneselfClientService expertOneselfClientService;
    
    	public IExpertOneselfClientService getExpertOneselfClientService() {
    		return expertOneselfClientService;
    	}
    	@Autowired
    	public void setExpertOneselfClientService(
    			IExpertOneselfClientService expertOneselfClientService) {
    		this.expertOneselfClientService = expertOneselfClientService;
    	}
    
    	public ILogTableTableService getLogTableTableService() {
    		return logTableTableService;
    	}
    
    	@Autowired
    	public void setLogTableTableService(
    			ILogTableTableService logTableTableService) {
    		this.logTableTableService = logTableTableService;
    	}
    
    	/**
    	 * 跳转到专家日程
    	 * 
    	 * @return
    	 */
    	@RequestMapping(value = "/main", method = RequestMethod.GET)
    	public String main() {
    		return "client/expertOneself/page/expertOneself_client";
    	}
    
    	/**
    	 * 显示专家日程
    	 * 
    	 * @param request
    	 * @param response
    	 * @param session
    	 * @throws IOException
    	 */
    	@RequestMapping(value = "/doList", method = RequestMethod.POST)
    	public void doList(HttpServletRequest request,
    			HttpServletResponse response, HttpSession session)
    			throws IOException {
    		Integer id = (Integer) session.getAttribute("id");
    		String start = request.getParameter("start");
    		String end = request.getParameter("end");
    		List<Object> list = null;
    		list = expertOneselfClientService.queryAllById(start, end, id);
    		JSONArray datas = JSONArray.fromObject(list);
    		response.setCharacterEncoding(Constants.ENCODING_UTF8);
    		response.getWriter().print(datas.toString());
    	}
    
    	/**
    	 * 添加
    	 * 
    	 * @param request
    	 * @param session
    	 * @param response
    	 * @param name
    	 * @param start
    	 * @param end
    	 * @param allDay
    	 * @throws IOException
    	 * @throws ParseException
    	 */
    	@RequestMapping(value = "/fullCalendarAdd", method = RequestMethod.POST)
    	public void fullCalendar(HttpServletRequest request, HttpSession session,
    			HttpServletResponse response,
    			@RequestParam(value = "titleName") String titleName,
    			@RequestParam(value = "start") Date start,
    			@RequestParam(value = "end") Date end,
    			@RequestParam(value = "eightColor") String eightColor,// 时间段8-10
    			@RequestParam(value = "tenColor") String tenColor,// 时间段10-12
    			@RequestParam(value = "thirteenColor") String thirteenColor,// 时间段13-15
    			@RequestParam(value = "fifteenColor") String fifteenColor,// 时间段15-17
    			@RequestParam(value = "allDay") Boolean allDay) throws IOException,
    			ParseException {
    		Integer adminId = (Integer) session.getAttribute("id");
    		String adminName = (String) session.getAttribute("adminName");
    
    		String[] array = { eightColor, tenColor, thirteenColor, fifteenColor };
    
    		for (int i = 0; i < array.length; i++) {
    			UpdateStatement(array[i], i, adminId, adminName, titleName, start,
    					end, eightColor, tenColor, thirteenColor, fifteenColor,
    					allDay);
    		}
    		// 日志记录
    		String name = (String) session.getAttribute("adminName");
    		String state1 = "专家日程_添加";
    		String jd = (String) session.getAttribute("jurisdiction");
    		logTableTableService.log(name, state1, jd);
    		log.info("doEdit  登录时间" + new Date() + "登录人"
    				+ session.getAttribute("adminName"));
    	}
    
    	/**
    	 * 根据时间条件 依次添加数据库 
    	 * @param array	 		颜色状态 -- 1绿色,2灰色
    	 * @param i				4个时间状态个数
    	 * @param adminId		用户id
    	 * @param adminName		用户名字
    	 * @param titleName		标题内容
    	 * @param start			几月几号  开始时间
    	 * @param end			几月几号	结束时间
    	 * @param eightColor	8点-10点
    	 * @param tenColor		10点-12点
    	 * @param thirteenColor	13点-15点
    	 * @param fifteenColor	15点-17点
    	 * @param allDay		是否全天
    	 */
    	private void UpdateStatement(String array, int i, Integer adminId,
    			String adminName, String titleName, Date start, Date end,
    			String eightColor, String tenColor, String thirteenColor,
    			String fifteenColor, Boolean allDay) {
    		FullCalendar fullCalendar = new FullCalendar();
    		if (i == 0) {
    			SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
    			String sDate = sf.format(start) + " 08:00:00";
    			String eDate = sf.format(end) + " 10:00:00";
    			fullCalendar.setTitle(titleName);
    			fullCalendar.setStartDate(sDate);
    			fullCalendar.setEndDate(eDate);
    			fullCalendar.setIfAllDay(allDay);
    			fullCalendar.setAdminid(adminId);
    			fullCalendar.setAdminName(adminName);
    			fullCalendar.setColor(eightColor);
    			expertOneselfClientService.insertCalendar(fullCalendar);
    		}else if(i == 1){
    			SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
    			String sDate = sf.format(start) + " 10:00:00";
    			String eDate = sf.format(end) + " 12:00:00";
    			fullCalendar.setTitle(titleName);
    			fullCalendar.setStartDate(sDate);
    			fullCalendar.setEndDate(eDate);
    			fullCalendar.setIfAllDay(allDay);
    			fullCalendar.setAdminid(adminId);
    			fullCalendar.setAdminName(adminName);
    			fullCalendar.setColor(tenColor);
    			expertOneselfClientService.insertCalendar(fullCalendar);
    		}else if(i == 2){
    			SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
    			String sDate = sf.format(start) + " 13:00:00";
    			String eDate = sf.format(end) + " 15:00:00";
    			fullCalendar.setTitle(titleName);
    			fullCalendar.setStartDate(sDate);
    			fullCalendar.setEndDate(eDate);
    			fullCalendar.setIfAllDay(allDay);
    			fullCalendar.setAdminid(adminId);
    			fullCalendar.setAdminName(adminName);
    			fullCalendar.setColor(thirteenColor);
    			expertOneselfClientService.insertCalendar(fullCalendar);
    		}else if(i == 3){
    			SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
    			String sDate = sf.format(start) + " 15:00:00";
    			String eDate = sf.format(end) + " 17:00:00";
    			fullCalendar.setTitle(titleName);
    			fullCalendar.setStartDate(sDate);
    			fullCalendar.setEndDate(eDate);
    			fullCalendar.setIfAllDay(allDay);
    			fullCalendar.setAdminid(adminId);
    			fullCalendar.setAdminName(adminName);
    			fullCalendar.setColor(fifteenColor);
    			expertOneselfClientService.insertCalendar(fullCalendar);
    		}
    	}
    
    	/**
    	 * 修改
    	 * 
    	 * @param request
    	 * @param session
    	 * @param response
    	 * @param id
    	 * @param name
    	 * @param allDay
    	 * @throws IOException
    	 * @throws ParseException
    	 */
    	@RequestMapping(value = "/fullCalendarEdit", method = RequestMethod.POST)
    	public void fullCalendarEdit(HttpServletRequest request,
    			HttpSession session, HttpServletResponse response,
    			@RequestParam(value = "id") Integer id,
    			@RequestParam(value = "name") String name,
    			@RequestParam(value = "color") String color,
    			@RequestParam(value = "allDay") Boolean allDay) throws IOException,
    			ParseException {
    		FullCalendar fullCalendar = new FullCalendar();
    		fullCalendar.setId(id);
    		fullCalendar.setTitle(name);
    		fullCalendar.setIfAllDay(allDay);
    		fullCalendar.setColor(color);
    		expertOneselfClientService.upCalendar(fullCalendar);
    		// 日志记录
    		String name1 = (String) session.getAttribute("adminName");
    		String state1 = "专家日程_修改";
    		String jd = (String) session.getAttribute("jurisdiction");
    		logTableTableService.log(name1, state1, jd);
    		log.info("doEdit  登录时间" + new Date() + "登录人"
    				+ session.getAttribute("adminName"));
    	}
    
    	/**
    	 * 删除
    	 * 
    	 * @param request
    	 * @param session
    	 * @param response
    	 * @param id
    	 * @throws IOException
    	 * @throws ParseException
    	 */
    	@RequestMapping(value = "/fullCalendarDel", method = RequestMethod.POST)
    	public void fullCalendarDel(HttpServletRequest request,
    			HttpSession session, HttpServletResponse response,
    			@RequestParam(value = "name") String name) throws IOException,
    			ParseException {
    		String start = request.getParameter("start");
    		String end = request.getParameter("end");
    		expertOneselfClientService.delCalendar(name,start,end);
    		// 日志记录
    		String name1 = (String) session.getAttribute("adminName");
    		String state1 = "专家日程_删除";
    		String jd = (String) session.getAttribute("jurisdiction");
    		logTableTableService.log(name1, state1, jd);
    		log.info("doEdit  登录时间" + new Date() + "登录人"
    				+ session.getAttribute("adminName"));
    	}
    	
    	
    	/**
    	 * 添加时查询当前用户当天是否添加过日程
    	 * 
    	 * @param request
    	 * @param response
    	 * @param session
    	 * @throws IOException
    	 */
    	@RequestMapping(value = "/queryCalendearByName", method = RequestMethod.POST)
    	public void queryCalendearByName(HttpServletRequest request,
    			HttpServletResponse response,HttpSession session)
    			throws IOException {
    		String adminName = (String) session.getAttribute("adminName");
    		String start = request.getParameter("start");
    		String end = request.getParameter("end");
    		List<Object> list = expertOneselfClientService.queryAll(start,end,adminName);
    		JSONArray jsonArray = JSONArray.fromObject(list);
    		response.setCharacterEncoding(Constants.ENCODING_UTF8);
    		response.getWriter().print(jsonArray.toString());
    	}
    	
    	
    	/**
    	 * 游客预约时  修改状态
    	 * 
    	 * @param request
    	 * @param response
    	 * @param session
    	 * @throws IOException
    	 */
    	@RequestMapping(value = "/bespeakExpert", method = RequestMethod.POST)
    	public void bespeakExpert(HttpServletRequest request,
    			HttpServletResponse response,HttpSession session)
    			throws IOException {
    		String id = request.getParameter("id");
    		String userName = request.getParameter("userName");
    		expertOneselfClientService.bespeak(id);
    		response.getWriter().print("1");
    	}
    }


    前台jsp代码

    <%@ page language="java" contentType="text/html; charset=UTF-8"
    	pageEncoding="UTF-8" import="java.util.List"%>
    <%@page import="com.model.FullCalendar"%> 
    
    <%
    	String root = request.getContextPath(); 
     %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html lang="en">
    <link href="<%=root%>/Web/css/bootstrap.min.css" rel="stylesheet" />
    <link rel="stylesheet" href="<%=root%>/Web/css/font-awesome.min.css" />
    <link rel="stylesheet" href="<%=root%>/Web/css/fullcalendar.css" />
    <link rel="stylesheet" href="<%=root%>/Web/css/ace.min.css" />
    <link rel="stylesheet" href="<%=root%>/Web/css/ace-rtl.min.css" />
    <link rel="stylesheet" href="<%=root%>/Web/css/ace-skins.min.css" />
    <script src="<%=root%>/Web/js/ace-extra.min.js"></script>
    <link rel="stylesheet" href="<%=root%>/Web/css/Lobibox.min.css"/>
    
    <script type="text/javascript">
    	var root = "<%=root%>"; //js中存放当前页面的root路径方便调用
    </script>
    
    <body>
    	<div class="breadcrumbs" id="breadcrumbs">
    		<ul class="breadcrumb" style="margin-top: 8px">
    			<li><i class="icon-home home-icon"></i>
    			</li>
    			<li class="active">专家时间表</li>
    		</ul>
    	</div>
    	<div class="page-content">
    			<div class="row">
    				<div class="col-xs-12">
    					<!-- PAGE CONTENT BEGINS -->
    
    					<div class="row">
    						<div class="col-sm-9">
    							<div id="calendar"></div>
    						</div>
    					</div>
    					<!-- PAGE CONTENT ENDS -->
    				</div><!-- /.col -->
    			</div><!-- /.row -->
    		</div><!-- /.page-content -->
    		
    		<div id="caozuo" class="modal">
    			<div class="modal-dialog" >
    					<div class="modal-content">
    						<div class="table">
    							<div class="form-group">
    								<label class="col-sm-3 control-label no-padding-right"
    									for="form-field-1"> 创建一个新的日程</label>
    								<div class="col-sm-9">
    									<textarea class="form-control input-focused" id="titleName" maxlength = "50" placeholder="日程名称"></textarea>
    									<div id="message" style="color: red;"></div>
    								</div>
    							</div>
    							<br/>
    							<br/>
    							<br/>
    							<br/>
    							<br/>
    							<div class="form-group">
    								<label class="control-label col-xs-12 col-sm-3 no-padding-right">8:00-10:00</label>
    								<div class="col-xs-12 col-sm-9">
    									<div>
    										<label> <input name="eightColor" value="1" checked type="radio" class="ace" /> <span class="lbl" style="color:green;font-weight:bold;"> 空闲  </span> </label>
    										<label> <input name="eightColor" value="2" type="radio" class="ace" /> <span class="lbl" style="color:gray;font-weight:bold;"> 锁定  </span> </label>
    										<label> <input name="eightColor" value="3" type="radio" class="ace" /> <span class="lbl" style="color:orange;font-weight:bold;"> 预约  </span> </label>
    									</div>
    								</div>
    							</div>
    							<br/>
    							<div class="form-group">
    								<label class="control-label col-xs-12 col-sm-3 no-padding-right">10:00-12:00</label>
    								<div class="col-xs-12 col-sm-9">
    									<div>
    										<label> <input name="tenColor" value="1" checked type="radio" class="ace" /> <span class="lbl" style="color:green;font-weight:bold;"> 空闲  </span> </label>
    										<label> <input name="tenColor" value="2" type="radio" class="ace" /> <span class="lbl" style="color:gray;font-weight:bold;"> 锁定  </span> </label>
    										<label> <input name="tenColor" value="3" type="radio" class="ace" /> <span class="lbl" style="color:orange;font-weight:bold;"> 预约  </span> </label>
    									</div>
    								</div>
    							</div>
    							<br/>
    							<div class="form-group">
    								<label class="control-label col-xs-12 col-sm-3 no-padding-right">13:00-15:00</label>
    								<div class="col-xs-12 col-sm-9">
    									<div>
    										<label> <input name="thirteenColor" value="1" checked type="radio" class="ace" /> <span class="lbl" style="color:green;font-weight:bold;"> 空闲  </span> </label>
    										<label> <input name="thirteenColor" value="2" type="radio" class="ace" /> <span class="lbl" style="color:gray;font-weight:bold;"> 锁定  </span> </label>
    										<label> <input name="thirteenColor" value="3" type="radio" class="ace" /> <span class="lbl" style="color:orange;font-weight:bold;"> 预约  </span> </label>
    									</div>
    								</div>
    							</div>
    							<br/>
    							<div class="form-group">
    								<label class="control-label col-xs-12 col-sm-3 no-padding-right">15:00-17:00</label>
    								<div class="col-xs-12 col-sm-9">
    									<div>
    										<label> <input name="fifteenColor" value="1" checked type="radio" class="ace" /> <span class="lbl" style="color:green;font-weight:bold;"> 空闲  </span> </label>
    										<label> <input name="fifteenColor" value="2" type="radio" class="ace" /> <span class="lbl" style="color:gray;font-weight:bold;"> 锁定  </span> </label>
    										<label> <input name="fifteenColor" value="3" type="radio" class="ace" /> <span class="lbl" style="color:orange;font-weight:bold;"> 预约  </span> </label>
    									</div>
    								</div>
    							</div>
    							<br/>
    						</div>
    						<div class="modal-footer">
    							<button class="btn btn-sm btn-success"  id="onSubmit">
    								<i class='icon-ok'></i> 添加
    							</button>
    							<button class="btn btn-sm "  data-dismiss="modal" id="close">
    								<i class="icon-remove"></i> 关闭
    							</button>
    						</div>
    					</div>
    				</div>
    			</div>
    			
    		<a href="#caozuo" id="jd" data-toggle='modal' class='tooltip-info' data-rel='tooltip' title='View'></a>
    		
    		<script src="<%=root%>/Web/js/jquery-2.1.1.min.js"></script>
    		<script src="<%=root%>/Web/js/bootstrap.min.js"></script>
    		<script src="<%=root%>/Web/js/typeahead-bs2.min.js"></script>
    
    		<!-- page specific plugin scripts -->
    
    		<script src="<%=root%>/Web/js/jquery-ui-1.10.3.custom.min.js"></script>
    		<script src="<%=root%>/Web/js/jquery.ui.touch-punch.min.js"></script>
    		<script src="<%=root%>/Web/js/fullcalendar.min.js"></script>
    		<script src="<%=root%>/Web/js/bootbox.min.js"></script>
    		<script type="text/javascript" src="<%=root%>/Web/js/lobibox.min.js"></script>
    		<script type="text/javascript" src="<%=root%>/Web/js/demo.js"></script>
    		
    		<script src="<%=root%>/Web/client/expertOneself/js/expertOneself_client.js"></script>
    </body>
    </html>

    前台js代码

    /**
     * 链接数据库
     * @param url 连接地址
     * @param data 传入参数
     * @param method 回调方法
     */
    var getAjaxFun = function (url, data, method) {
        $.ajax({
            async: false,
            cache: false,
            type: 'POST',
            dataType: "json",
            url: url,
            data: data,
            success: function (data) {   //请求成功
                method(data);
            },
            // 请求的action路径
            error: function () {        // 请求失败处理函数
                Lobibox.alert('error', {
                    msg: "请求失败!"
                });
            }
        });
    };
    
    (function ($) {
        var calendar;
        //日历初始化
        function calendarInit() {
            calendar = $('#calendar').fullCalendar({
                firstDay: 1,//每周开始的日期:0为周日
                isRTL: false,//是否从右至左组织日历
                weekends: true,//是否显示周末
                defaultView: 'month',//初始化时的默认视图,month、agendaWeek、agendaDay
                allDaySlot: true,//agenda视图下是否显示all-day
                allDayText: '今日',//agenda视图下all-day的显示文本
                slotMinutes: 30,//agenda视图下两个相邻时间之间的间隔
                eventLimit: true,
                allDayDefault: false,
                //设置头部信息,如果不想显示,可以设置header为false
                header: {
                    //日历头部左边:初始化切换按钮
                    left: 'prev,next today',
                    //日历头部中间:显示当前日期信息
                    center: 'title',
                    //日历头部右边:初始化视图
                    right: 'month,agendaWeek,agendaDay'
                },
                editable: false,	//是否可拖拽
                droppable: false, 	//这允许事情被扔到日历上!!!
                selectable: true,	//是否选中对应元素
                selectHelper: false,
                events: calendearSelect,//初始化日程表
                select: calendearAdd,
                eventClick: calendearSelectEdit,
                eventMouseover: calendearMouseover
            });
        }
    
        //读取日历数据
        function calendearSelect(start, end, callback) {
            //只显示本页数据
            var fstart = $.fullCalendar.formatDate(start, "yyyy-MM-dd HH:mm:ss");
            var fend = $.fullCalendar.formatDate(end, "yyyy-MM-dd HH:mm:ss");
            getAjaxFun(root + "/expertOneselfClient/doList", {
                "start": fstart,
                "end": fend
            }, function (reData) {
                var events = [];
                for (var i = 0; i < reData.length; i++) {
                    var array_element = reData[i];
                    var title = array_element.adminName + ":" + array_element.title;
                    if (array_element != null) {
                        var color = "";
                        if (array_element.color == 1) {
                            color = "green";
                        } else if(array_element.color == 2){
                            color = "gray";
                        } else if(array_element.color == 3){
                        	color = "orange";
                        }
                        var tjson = {
                            id: array_element.id,
                            title: title,
                            start: array_element.startDate,
                            end: array_element.endDate,
                            color: color,
                            allDay: array_element.ifAllDay
                        };
                        events.push(tjson);
                    }
                }
                callback(events);
            });
        }
    
        //添加
        function calendearAdd(start, end, allDay) {
        	var aa = queryCalendearByName(start, end, allDay);
        	if(aa != ""){
        		Lobibox.alert('success', {
        			msg: "一个用户一天只能添加4条日程",
        		});
        		return;
        	}
            document.getElementById("jd").click();
            $("#titleName").val("");
            $("#expertMe").html("");
            $("#message").html("");
            //摧毁上次绑定的事件
            $("#onSubmit").unbind();
            $("#onSubmit").click(function () {
                if ($("#titleName").val() != "") {
                    calendar.fullCalendar('renderEvent',
                        {
                            title: $("#titleName").val(),
                            start: start,
                            end: end,
                            allDay: allDay
                        },
                        true, // make the event "stick"
                        document.getElementById("close").click()
                    );
                    Lobibox.alert('success', {
                        msg: "添加成功",
                        callback: function ($this, type, ev) {
                            window.location.reload();
                            //$('#calendar').fullCalendar('refetchEvents');
                        }
                    });
                } else {
                    $("#message").html("请输入日程");
                    return;
                }
                calendar.fullCalendar('unselect');
                //var color = $("input[type='radio']:checked").val();
                var one = "";
                var two = "";
                var three = "";
                var four = "";
                var eightColor = document.getElementsByName("eightColor");
                var tenColor = document.getElementsByName("tenColor");
                var thirteenColor = document.getElementsByName("thirteenColor");
                var fifteenColor = document.getElementsByName("fifteenColor");
    
                for (var i = 0; i < eightColor.length; i++) {
                    if (eightColor[i].checked)one = eightColor[i].value;
                }
                for (var i = 0; i < tenColor.length; i++) {
                    if (tenColor[i].checked)two = tenColor[i].value;
                }
                for (var i = 0; i < thirteenColor.length; i++) {
                    if (thirteenColor[i].checked)three = thirteenColor[i].value;
                }
                for (var i = 0; i < fifteenColor.length; i++) {
                    if (fifteenColor[i].checked)four = fifteenColor[i].value;
                }
    
                //val = 1 绿色空闲,val = 2 灰色锁定
                $.ajax({
                    async: false,
                    cache: false,
                    type: 'POST',
                    dataType: "text",
                    data: {
                        "titleName": $("#titleName").val(),
                        "start": start,
                        "end": end,
                        "eightColor": one, //8点-10点
                        "tenColor": two,	 //10点-12点
                        "thirteenColor": three,	//13点-15点
                        "fifteenColor": four,	//15点-17点
                        "allDay": allDay
                    },
                    url: root + "/expertOneselfClient/fullCalendarAdd",
                    //请求的action路径
                    error: function () { //请求失败处理函数
                        Lobibox.alert('error', {
                            msg: "请求失败",
                            callback: function ($this, type, ev) {
                                window.location.reload();
                            }
                        });
                    }
                });
            });
        }
        
        //添加之前查询  这个专家 当日 是否添加过日程
        function queryCalendearByName(start, end, allDay){
        	var judge;
        	var fstart = $.fullCalendar.formatDate(start, "yyyy-MM-dd HH:mm:ss");
            var fend = $.fullCalendar.formatDate(end, "yyyy-MM-dd HH:mm:ss");
        	getAjaxFun(root + "/expertOneselfClient/queryCalendearByName", {
                "start": fstart,
                "end": fend
            }, function (reData) {
            	judge = reData;
            });
        	return judge;
        }
    
        //修改
        function calendearSelectEdit(calEvent, jsEvent, view) {
            var fstart = $.fullCalendar.formatDate(calEvent.start, "HH:mm");
            var fend = $.fullCalendar.formatDate(calEvent.end, "HH:mm");
            var start = $.fullCalendar.formatDate(calEvent.start, "yyyy-MM-dd HH:mm:ss");
            var end = $.fullCalendar.formatDate(calEvent.end, "yyyy-MM-dd HH:mm:ss");
            var str = "";
            var reg = /[^:]*:([^:]*)/;
            str = calEvent.title.replace(reg, "$1");
            //截取冒号之前  取专家名字
            var adminName = calEvent.title.substr(0, calEvent.title.indexOf(':'));
            var form = $("<form class='form-inline'><lable>修改日程 </lable><div class='modal'></form>");
            form.append("<textarea class='form-control input-focused' id='textarea' maxlength = '50' autocomplete=off placeholder='日程名称'>" + str + "</textarea><div id='messageEdit' style='color: red;'></div>");
            form.append("时间段:");
            form.append("<form class='form-inline'><label>" + fstart + "-" + fend + "  </label></form>");
            if (calEvent.color == "green") {
                form.append("<label class='blue'> <input name='colorEdit' value='1' checked type='radio' class='ace' /> <span class='lbl' style='color:green;font-weight:bold;'> 空闲  </span> </label>");
                form.append("<label class='blue'> <input name='colorEdit' value='2' type='radio' class='ace' /> <span class='lbl' style='color:gray;font-weight:bold;'> 锁定   </span> </label>");
                form.append("<label class='blue'> <input name='colorEdit' value='3' type='radio' class='ace' /> <span class='lbl' style='color:orange;font-weight:bold;'> 预订   </span> </label>");
            } else if(calEvent.color == "gray"){
                form.append("<label class='blue'> <input name='colorEdit' value='1' type='radio' class='ace' /> <span class='lbl' style='color:green;font-weight:bold;'> 空闲   </span> </label>");
                form.append("<label class='blue'> <input name='colorEdit' value='2' checked type='radio' class='ace' /> <span class='lbl' style='color:gray;font-weight:bold;'> 锁定   </span> </label>");
                form.append("<label class='blue'> <input name='colorEdit' value='3' type='radio' class='ace' /> <span class='lbl' style='color:orange;font-weight:bold;'> 预订   </span> </label>");
            } else if(calEvent.color == "orange"){
            	form.append("<label class='blue'> <input name='colorEdit' value='1' type='radio' class='ace' /> <span class='lbl' style='color:green;font-weight:bold;'> 空闲   </span> </label>");
                form.append("<label class='blue'> <input name='colorEdit' value='2' type='radio' class='ace' /> <span class='lbl' style='color:gray;font-weight:bold;'> 锁定   </span> </label>");
                form.append("<label class='blue'> <input name='colorEdit' value='3' checked type='radio' class='ace' /> <span class='lbl' style='color:orange;font-weight:bold;'> 预订   </span> </label>");
            }
            form.append("<br/>");
            form.append("<br/>");
            var div = bootbox.dialog({
                message: form,
                buttons: {
                    "edit": {
                        "label": "<i class='icon-ok'></i> 保存",
                        "className": "btn btn-sm btn-success",
                        "callback": function () {
                            var val = $("#textarea").val();
                            var color = $("input[name='colorEdit']:checked").val();
                            if (val != "") {
                                $.ajax({
                                    async: false,
                                    cache: false,
                                    type: "POST",
                                    dataType: "text",
                                    data: {
                                        "id": calEvent.id,
                                        "name": val,
                                        "color": color,
                                        "allDay": calEvent.allDay
                                    },
                                    url: root + "/expertOneselfClient/fullCalendarEdit",
                                    //请求的action路径
                                    error: function () { //请求失败处理函数
                                        Lobibox.alert('error', {
                                            msg: "请求失败"
                                        });
                                    },
                                    success: function (data) {
                                        if (data == "") {
                                            Lobibox.alert('success', {
                                                msg: "修改成功",
                                                callback: function ($this, type, ev) {
                                                    window.location.reload();
                                                }
                                            });
                                        }
                                    }
                                });
                                //calendar.fullCalendar('updateEvent', calEvent);
                                div.modal("hide");
                                return false;
                            } else {
                                $("#messageEdit").html("请输入日程");
                                return false;
                            }
                        }
                    },
                    "delete": {
                        "label": "<i class='icon-trash'></i> 删除",
                        "className": "btn-sm btn-danger",
                        "callback": function () {
                            //截取冒号之前  取专家名字
                            var adminName = calEvent.title.substr(0, calEvent.title.indexOf(':'));
                            Lobibox.confirm({
                                msg: "是否删除当天日程?",
                                callback: function ($this, type, ev) {
                                    if (type == "yes") {
                                        $.ajax({
                                            async: false,
                                            cache: false,
                                            type: "POST",
                                            dataType: "text",
                                            data: {
                                            	"start": start,
                                            	"end": end,
                                                "name": adminName
                                            },
                                            url: root + "/expertOneselfClient/fullCalendarDel",
                                            //请求的action路径
                                            error: function () { //请求失败处理函数
                                                Lobibox.alert('error', {
                                                    msg: "请求失败"
                                                });
                                            },
                                            success: function (data) {
                                                if (data == "") {
                                                    Lobibox.alert('success', {
                                                        msg: "删除成功",
                                                        callback: function ($this, type, ev) {
                                                            window.location.reload();
                                                        }
                                                    });
                                                }
                                            }
                                        });
                                        calendar.fullCalendar('removeEvents', function (ev) {
                                            return (ev._id == calEvent._id);
                                        })
                                    }
                                }
                            });
                        }
                    },
                    "close": {
                        "label": "<i class='icon-remove'></i> 关闭",
                        "className": "btn-sm"
                    }
                }
            });
        }
    
        //鼠标放上去显示信息
        function calendearMouseover(calEvent, jsEvent, view) {
            var str = "";
            var reg = /[^:]*:([^:]*)/;
            str = calEvent.title.replace(reg, "$1");
            var fstart = $.fullCalendar.formatDate(calEvent.start, "yyyy-MM-dd HH:mm");
            var fend = $.fullCalendar.formatDate(calEvent.end, "yyyy-MM-dd HH:mm");
            $(this).attr('title', fstart + " - " + fend + " " + str);   //鼠标悬浮到title的时候可以设置展现哪些信息
            $(this).css('font-weight', 'normal');
        }
    
        //添加绑定
        function addBangDing() {
            $('#expert').change(function () {
                calendar.fullCalendar('refetchEvents');
            });
        }
    
        calendarInit();     //日历初始化
        addBangDing();
    })(window.jQuery);
    
    



    以上就是 所有代码 

    最后展示一下效果图!!





    展开全文
  •  在应用selenium实现web自动化时,经常会遇到处理日期控件点击问题,手工很简单,可以一个个点击日期控件选择需要的日期,但自动化执行过程中,完全复制手工这样的操作就有点难了。 2、想法:  其实很简单,把它...

     

    如图:

     

            

    1、问题描述:

          在应用selenium实现web自动化时,经常会遇到处理日期控件点击问题,手工很简单,可以一个个点击日期控件选择需要的日期,但自动化执行过程中,完全复制手工这样的操作就有点难了。

    2、想法:

            其实很简单,把它当做输入框来看就好了,使用selenium的sendKeys对输入框输入日期则可。

            driver.findElement(By.id("createTime")).sendKeys("2016-08-24");//输入日期

    3、想法是很美好的,但是有时候实行起来却不执行,这个时候我们就要仔细去看看前端的代码了,代码如下:

         <div class="col-lg-3 form-input">

                  <input id="createTime" class="form-control" type="text" readonly="" name="tatsudoDate" οnclick="WdatePicker()" aria-required="true">

         </div>

    4、这个时候我们可以移除readonly的属性,问题就轻轻松松解决了,代码如下:

      String js = "document.getElementById('createTime').removeAttribute('readonly')";     // 原生js,移除属性

        ((JavascriptExecutor)driver).executeScript(js);    //将driver强制转换为JavascriptExecutor类型

      driver.findElement(By.id("createTime")).sendKeys("2016-08-24");    //输入日期
     

    5、代码里面一定要记得导入这个方法:

    import org.openqa.selenium.JavascriptExecutor;

     

     

    展开全文
  • jedate日期控件

    千次阅读 2016-09-02 11:12:31
    一款简单又便捷的超好用日期控件----jedate
  • web打印,web打印控件的三种实现方法 zz 做管理系统的时候,打印一直是个棘手的问题,做B/S的系统这个问题就更加突出了!下面举出三种常用的web打印处理方式 1、利用word或者excel来实现web打印(如果不修改ie...
  • PAZU 是4Fang 为配合“四方在线”软件于2004年开发的WEB打印控件,适用于各种WEB软件项目的打印。   PAZU是客户端软件,使用于IE作为客户端的所有应用,与服务器端开发语言无关,即PAZU支持所有的开发语言开发...
  • 日期控件使用总结

    2016-09-12 16:13:37
    1.控件介绍 DatePicker目录是一个整体,不可破坏里面的目录结构,也不可对里面的文件改名,可以改目录名 DatePicker.htm 是必须文件,不可删除(4.8以后不存在此文件) 各目录及文件的用途: WdatePicker.js 配置文件,在...
  • 绿色日期控件皮肤 My97 DatePicker

    千次阅读 2017-04-07 14:12:34
    因项目需要,给 My97 DatePicker 新做了一个绿色的皮肤详细的使用方法见:http://aweb.cc/article/detail/id/508.html文件尺寸24.52 KB下载次数79
  • Struts2中的日期控件和Tree控件

    千次阅读 2008-12-05 15:53:00
    日期控件head>meta http-equiv="Content-Type" content="text/html; charset=GBK"/>title>使用s:datetimepicker生成日期选择框title>s:head theme="ajax" /> //一定加上theme,否则下面的时间显示不出来head>...
  • web 打印,web打印控件的三种实现方法 zz 做管理系统的时候,打印一直是个棘手的问题,做B/S的系统这个问题就更加突出了!下面举出三种常用的web打印处理方式 1、利用word或者excel来实现web打印(如果不修改...
  • android时间日期控件

    千次阅读 2012-11-25 16:51:52
    日期控件大家不陌生了,web开发中用的是datepicker。同样的android也有类似的日期控件和时间控件。android的这2种组件分别叫做TimePicker和DatePicker。先来看下TImePicker,下面这个就是   还有一个叫做...
  • Java Web应用开发

    千次阅读 2020-03-30 10:20:29
    Java Web应用开发01 Web应用开发简介单元测验102网页开发基础节内小测2.1 HTML 技术2.2 CSS2.3 【阶段案例2】图书商城首页设计02 网页基础--单元测验03 JavaScript技术节内小测3.1 JavaScript语言基础3.2 JavaScript...
  • WdatePicker日期控件

    千次阅读 2012-11-20 11:32:21
    WdatePicker,相信这个控件大家都很了解,很好用的一个JS日期控件。  这次是为了自己记录下如何输出yyyy-MM-dd HH:mm:ss这样的datetime形式 $('#AssociationForm').validate({buildTime : {date:true,...
  • Java WEB

    2021-06-04 21:57:22
    总结: 今天开始,正式进入Java WEB的阶段,WEB就离不开页面的交互,能够用我们的眼睛可以直观地看到,WEB大部分会用在前端的技术栈当中,在前端的这部分叫WEB全栈,它的结构是:PHP+Apache+MySQL+Linux,那么后端...
  • 2012年1月至3月出差北京参与一个对日JAVA WEB项目开发,日期型控件是这类项目必不可少的工具之一。以下是采用my97日期控件的一些心得体会。...首先在jsp页面head部引入日期控件js文件。 "> 日期开始
  • PAZU -- 4Fang WEB 打印控件

    千次阅读 2009-12-02 13:29:00
    无限制免费版,完美您的WEB应用一、概述PAZU 是4Fang 为配合“四方在线”软件于2004年开发的WEB打印控件,适用于各种WEB软件项目的打印。 PAZU是客户端软件,使用于IE作为客户端的所有应用,与服务器端开发语言无关...
  • java ee web开发学习笔记

    千次阅读 2015-10-28 10:20:29
    新手学习时遇到调用日期控件的js
  • C#网页设计 - Web控件

    千次阅读 2019-05-03 17:45:34
    1. 服务器控件 ASP.NET控件分为服务器控件和HTML标记。 服务器控件是在服务器端运行的执行程序逻辑的组件,服务器端的程序可以访问这类控件;而HTML标记是在客户端运行的,服务器端程序不能访问这类控件。 ...
  • My97DatePicker日期控件用法

    千次阅读 2013-09-15 12:26:49
    下面列出的是和Java通信是用到的Web.xml和DatePickerServlet.java <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
  • Java导入导出Excel控件简介

    千次阅读 2018-09-15 11:25:46
    1、Apache POI - 微软文档的Java API http://poi.apache.org/ Apache POI项目的任务是基于Office OpenXML标准(OOXML)和微软的OLE 2复合文档格式(OLI2)创建和维护Java API以操纵各种文件格式。简而言之,你可以...
  • struts2中日期控件

    2014-02-13 19:16:44
    2.在要生成日期控件的页面头部加上:   3.然后在web页面的head标签下面加上 也可以加上下面两句话  theme="xhtml"/>   parseContent="true"/>    4.现在就可以实现各种日期控件 ...
  • WEB打印控件Lodop(V6.x)使用说明及样例

    千次阅读 2016-11-07 14:42:34
    WEB打印控件Lodop(V6.x)使用说明及样例   Lodop是专业WEB控件,用它既可裁剪输出页面内容,又可用程序代码生成复杂打印页。 控件功能强大,却简单易用,所有调用如同JavaScript扩展语句,主要接口函数如下...
  • 从事IT行业的都知道一个开发者的水平基本取决于你做过多少项目,唯有见多才能识广,这次收集的34套Java经典项目主要包括26套Java web项目,6套Java swing项目,2套Java控制台项目,所有项目都包含开发视频教程和完整...
  • Highcharts图表控件是目前使用最为广泛的图表控件。本文将从零开始逐步为你介绍Highcharts图表控件。通过本文,你将学会如何配置Highcharts以及动态生成Highchart图表。   目录 前言(Pre
  • 日期控件--My97DatePicker

    千次阅读 2012-04-15 15:19:17
    日期控件--My97DatePicker使用示例 1.网上下载My97DatePicker,将其导入到web项目中。 2.在页面上引入WdatePicker.js 示例: 3.在input里添加点击事件,直接调用WdatePicker 4.效果如下: 5....

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 12,962
精华内容 5,184
关键字:

javaweb日期控件

java 订阅