The following snippet submits a caption to the database. After filling in the text , i click submit but to my surprise always a null goes to the table. I have metioned the servlet code and the html design below:
<form method="post" action="Handler" enctype="multipart/form-data">
        <table>
            <tr>
                <td> <strong> Leave a caption </strong>  </td>
                <td> <input type="text" name="caption box" size="40" /></td>
            </tr>
            <tr colspan="2">
                <td> <input type="submit" value="submit caption"/> </td>
            </tr>
        </table>
    </form>
Servlet
String caption = request.getParameter("caption box"); // get the caption from the caption field
HandleCaption hc = new HandleCaption(caption,emailOfTheUser,fileName);
hc.SubmitCaptionToTheDatabase(); 
Class
public class HandleCaption {
private String Caption = null;
private String UserEmail = null;
private String NameOfThe = null;
public HandleCaption(String caption,String email,String filename) {
    Caption = caption;
    UserEmail = email;
    NameOfThe = filename;
}
public void SubmitCaptionToTheDatabase() {
    try {
        Context context = new InitialContext();
        DataSource ds = (DataSource)context.lookup("java:comp/env/jdbc/DS");
        Connection connection = ds.getConnection();
        String sqlQuery = "insert into CAPTIONS values ('" + UserEmail + "','" + NameOfThe + "','" + Caption + "')";
        PreparedStatement statement = connection.prepareStatement(sqlQuery);
        int x = statement.executeUpdate();
    }catch(Exception exc) {
        exc.printStackTrace();
    }
}
}
I tried printing the value the text-field returned in the servlet which even the printed null. Why the text-field returns null ?
 
     
     
    