我的形式是
<form action="newjsp.jsp">
<input name="date" type="date" />
<input type="submit" value="submit" />
</form>
这是我的newjsp.jsp
<%
String Month = (String)request.getParameter("date").substring(0, 2);
String Day = (String)request.getParameter("date").substring(3, 5);
String Year = (String)request.getParameter("date").substring(6, 10);
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:derby://localhost:1527/Database","Administrator","admin");
Statement st = con.createStatement();
int i = st.executeUpdate("INSERT INTO ADMINISTRATOR.DATA(Year, Month, Day) values ('" + Year + "','" + Month + "','" + Day + "'");
if (i > 0) {
response.sendRedirect("registerm.jsp");
}
%>
我想要的是从日期输入中获取日,月和年,并将每个存储在我的数据库的一列中。 我究竟做错了什么?或者它是如何完成的?