Web tier: servlets, JSP, Web frameworks: inserting an httpservletrequest object into a database date fiel

  1. i do the following and I get a syntax error stating that i cant convert from string to date?


    I do the following and i cant convert to an integer?

  2. Bob
    You need to convert the string object to a date before using pstmt.setDate or setInt method.

    java.text.SimpleDateFormat fmt = new java.text.SimpleDateFormat(fmtstr);
    //fmtstr = "dd/MM/yyyy"

    java.util.Date dt = fmt.parse(request.getParameter("T"));

    Similarly you must use Integer.parse(request.getParameter("X")); method before using setInt method.

    Hope this helps.