How do I get the following code to work?
String d=request.getParameter("bday");
GET parameter is null value but i m storing here html datepicker, even though I'm passing a value
Extra_User.jsp
<html>
<body>
<form name="frm1" method="post" action="Extra_User_Data.jsp">
<font size="4">Birthday<td><input type="date" id="bday">
</form>
</body>
</html>
Extra_User_Data.jsp
<%@page import="java.sql.*"%>
<%
try
{
String d=request.getParameter("bday");
Connection cn;
Statement st;
Class.forName("com.mysql.jdbc.Driver");
cn=DriverManager.getConnection("jdbc:mysql://localhost:3306/main","root","");
st=cn.createStatement();
st.executeUpdate("INSERT INTO newuser(dob)VALUES('"+d+"')");
out.println("Insert SuccessFull");
}
catch(SQLException sq)
{
out.println(sq.toString());
}
%>
I am passing some date from html form to another .jsp file but while adding data in data base its shows null value.
it's shows error like...
com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect date value: 'null' for column 'dob' at row 1
Use name instead of id for your input