I am new to Spring Framework and java. I was creating Registration Module for my Web App. I created DAO, DTO, Dispatcher Servlet, controller and all. When I submit the form it redirects me to where I want to go but no data are added to the Database.. 

My userDTO.java

```
    package com.lagan.dto;

public class userDto{

    public String userId;
    public String firstName;
    public String lastName;
    public String birthDate;
    public int gender;
    public String email;
    public String password;

    public String getUserId() {
        return userId;
    }
    public String getUserId(String userId) {
        return userId;
    }
    public void setUserId(String userId) {
        this.userId = userId;
    }
    public String getFirstName() {
        return firstName;
    }
    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }
    public String getLastName() {
        return lastName;
    }
    public void setLastName(String lastName) {
        this.lastName = lastName;
    }
    public String getBirthDate() {
        return birthDate;
    }
    public void setBirthDate(String birthDate) {
        this.birthDate = birthDate;
    }
    public int getGender() {
        return gender;
    }
    public void setGender(int gender) {
        this.gender = gender;
    }
    public String getEmail() {
        return email;
    }
    public void setEmail(String email) {
        this.email = email;
    }
    public String getPassword() {
        return password;
    }
    public void setPassword(String password){
        this.password = password;
    }
}

```

userDao.java

```
package com.lagan.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

import com.lagan.dbconnector.dbconnect;
import com.lagan.dto.userDto;

public class userDao {
    public void create (userDto user) {
        dbconnect db=new dbconnect();
        Connection con=null;
        try{
            con=db.getConnections();
            String sql="insert into tbluser values(?,?,?,?,?,?,?)";
            PreparedStatement pre=con.prepareStatement(sql);
            pre.setString(1,user.getUserId());
            pre.setString(2,user.getFirstName());
            pre.setString(3,user.getLastName());
            pre.setString(4,user.getBirthDate());
            pre.setInt(5,user.getGender());
            pre.setString(6,user.getEmail());
            pre.setString(7,user.getPassword());
            pre.executeUpdate();
            pre.close();
        }catch (Exception e) {
            e.printStackTrace();

        }finally {
            db.closeConnection(con);
        }

    }
}

```

userController.java

```
package com.lagan.controller;
import java.util.List;

import com.lagan.dao.userDao;
import com.lagan.dto.userDto;

public class userController {
    public void create(userDto userDto){
        userDao dao=new userDao();
        dao.create(userDto);
    }
}

```

Verification.jsp

```
<%@ page import="com.lagan.controller.*,com.lagan.dto.*"%>
<%
    String userId="aqwery";
    String firstName=request.getParameter("firstName");
    String lastName=request.getParameter("lastName");
    String birthDate=request.getParameter("birthDate");
    //int gender=request.getParameter("gender");
    String email=request.getParameter("email");
    String password=request.getParameter("password");

    userDto dto=new userDto();

    dto.getUserId(userId);
    dto.setFirstName(firstName);
    dto.setLastName(lastName);
    dto.setBirthDate(birthDate);
    //dto.setGender(gender);
    dto.setEmail(email);
    dto.setPassword(password);
    userController uC=new userController();
    uC.create(dto);
    response.sendRedirect("home.html");
%>

```

dbconnect.java

```
package com.lagan.dbconnector;

import java.sql.*;

//import java.sql.Connection;
//import java.sql.DriverManager;
//import java.sql.SQLException;

public class dbconnect {
    public dbconnect()
    {
        try {
            Class.forName("com.mysql.jdbc.Driver");
        } catch (ClassNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

public Connection getConnections() {
    Connection conn=null;
    try{
    conn=DriverManager.getConnection("jdbc:mysql://localhost:80/project_lagan","root","");
    } catch (SQLException e) {
        e.printStackTrace();
    }
    return conn;
}

public void closeConnection(Connection con){
    if(null!=con) {
        try{
            con.close();

        }catch(SQLException e){}
    }
}
}

```

It redirects me to home.html but the datas are not added to the database. I don't know what i am doing wrong. Please Help.