java - getting Class Cast Exception while sending date to DAO Class -
// I'm trying to send a date to my Dao class, but I'm getting an exception string date Is = request.getParameter ("Date"); Date date = null; SimpleDataformat SDF = New SimpleDormat ("DD / MM / YEA"); Try / I am importing java.sql.Date // I am getting java.lang.ClassCastException: java.util.Date to java.sql.Date date = (date) sdf.parse (dateInString) Can not be put in; } Hold (ParseException e) {e.printStackTrace (); } Skip leave leave = new leave (associate id, date, buffer, applicator, buffer); AssoicatesDAO = new AssociatesAO (); Boolean success = AssociatesAo LevelBelance (Skip); If (success) {msg = "Associate's vacation has been successfully added."; } Other {msg = "****"; } Request.setAttribute ("Feedback Message", msg); Sender = request.getRequestDispatcher ("/ jsp / success.jsp"); Dispatcher. Forwarded (request, response); }
in the form of you java.util.Date With SimpleDateFormat with java.util.Date and not java.sql.Date / div>
Comments
Post a Comment