Bonjour
je suis bloquée depuis deux semaines, je cherche à faire récupérer la date à partir d'un calendrier pour l'insérer dans la base de données .
avec les types int et String je n'ai pas de problèmes d'insertion dans la base mais pas avec le type Date.
voici ce que j'obtiens quand j'essaie d'insérer des valeurs de type date identiques à celles insérées manuellement dans la base.
Field error in object 'command' on field 'createdAt': rejected value []; codes [typeMismatch.command.createdAt,typeMismatch.createdAt,typeMismatch.java.util.Date,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [command.createdAt,createdAt]; arguments []; default message [createdAt]]; default message [Failed to convert property value of type [java.lang.String] to required type [java.util.Date] for property 'createdAt'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [java.util.Date] for property 'createdAt': no matching editors or conversion strategy found]
d'autre part je ne peux pas sélectionner la date de mon calendrier
voici le code de ma page HTML
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
| <%@ page import="java.text.*" %>
<%@ page import="java.util.*" %>
<%@ include file="/WEB-INF/jsp/include.jsp" %>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<style type="text/css">
.even {
background-color: silver;
}
</style>
<title>Registration Page</title>
<script language="JavaScript" src="C:/Users/fehd/Desktop/SpringIDE/vacation/WebContent/calendar_db.js"></script>
<link rel="stylesheet" href="C:/Users/fehd/Desktop/SpringIDE/vacation/WebContent/calendar.css">
</head>
<body>
<% SimpleDateFormat dateFormatter = new SimpleDateFormat(); %>
<center> <h1>Ajouter un Congé</h1> </center>
<h1><img class="png" src="C:/Users/fehd/Desktop/SpringIDE/vacation/WebContent/img/Proxym.png" /></h1>
<form:form action="add.htm" commandName="vacation">
<table>
<tr> <td>Date :</td> <td><%= dateFormatter.format(new Date()) %></td> </tr>
<tr>
<td>Date début:</td>
<td><form:input path= "startDate" /></td>
</tr>
<tr>
<td>Date fin :</td>
<td><form:input path="endDate" /></td>
</tr>
<!-- JSP content -->
<!-- JSP content -->
<tr>
<td>Durée:</td>
<td><form:input path="duration" /></td>
</tr>
<tr>
<td>jours ouvrables:</td>
<td><form:input path="numberOfWorkingDays" /></td>
</tr>
<tr>
<td>absence:</td>
<td><form:input path="halfDay" /></td>
</tr>
<tr>
<td>Date de création:</td>
<td><form:input path="createdAt" /></td>
</tr>
<tr>
<td>Date de suppression:</td>
<td><form:input path="deletedAt" /></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Register"></td>
</tr>
</table>
</form:form>
<form name="testform">
<!-- calendar attaches to existing form element -->
<input type="text" name="startDate" id="startDate"/>
<script language="JavaScript">
new tcal ({
// form name
'formname': 'testform',
// input name
'controlname': 'startDate'
});
</script>
</form>
<c:if test="${fn:length(vacationList)> 0}">
<table cellpadding="5">
<tr class="even">
<th>Date début</th>
<th>Date fin </th>
<th>Durée</th>
<th>jours ouvrables</th>
<th>absence</th>
<th>Date de création</th>
<th>Date de suppression</th>
</tr>
<c:forEach items="${vacationList}" var="vacation" varStatus="status">
<tr class="<c:if test="${status.count % 2 == 0}">even</c:if>">
<td>${vacation.startDate}</td>
<td>${vacation.endDate}</td>
<td>${vacation.duration}</td>
<td>${vacation.numberOfWorkingDays}</td>
<td>${vacation.halfDay}</td>
<td>${vacation.createdAt}</td>
<td>${vacation.deletedAt}</td>
</tr>
</c:forEach>
</table>
</c:if>
<a href="<c:url value="/accueil.htm"/>">Home</a>
</body>
</html> |
y inclus le code et script du calendrier qui s'affiche comme suit [IMG]
[/IMG]
je ne peux pas saisir la date de ce calendrier la diriger vers un champs approprié que je choisis moi même .
C'est très urgent SVP !
Je serais très reconnaissante si vous m'aidiez!
Partager