@RequestMapping(value = "save", method = RequestMethod.POST) public String save( @ModelAttribute(value = "Schedule") Schedule schedule, @Context HttpServletRequest request) throws ParseException { Calendar calendar = Calendar.getInstance(); schedule.setScheduleDate(calendar.getTime()); DateFormat formatDate = new SimpleDateFormat("yyyy-MM-dd"); Date formatedDate = formatDate.parse(request.getParameter("schedule_date")); schedule.setScheduleDate(formatedDate); schedule.setScheduleTime(calendar.getTime()); SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); Date SimpleDateFormat = sdf.parse(request.getParameter("schedule_time")); schedule.setScheduleTime(SimpleDateFormat); scheduleService.insert(schedule); return "redirect:/admin/schedule"; }
private Schedule mapData(ResultSet rs) throws SQLException { Schedule schedule = new Schedule(); schedule.setApplicantId(rs.getInt("applicant_id")); schedule.setInterviewer(rs.getInt("interviewer")); schedule.setMessageForApplicant(rs.getString("message_for_applicant")); schedule.setMessageForInterviewer(rs.getString("message_for_interviewer")); schedule.setRemarks(rs.getString("remarks")); schedule.setScheduleDate(rs.getDate("schedule_date")); schedule.setScheduleTime(rs.getTime("schedule_time")); schedule.setEditDate(rs.getDate("edit_date")); schedule.setScheduleId(rs.getInt("schedule_id")); schedule.setScheduleStatus(rs.getBoolean("schedule_status")); /*if(rs.getTime("schedule_time")!=null){ schedule.setScheduleTime(rs.getTime("schedule_time")); }*/ return schedule; }