Hello to all of you guyss...
I'm sharing this cause i can't find the cause of inputs to become null..

i have this addresident.jsp jsp that contains this popup

<tr id = "Married_Form" >
				<td>Wife's First Name</td>				
				<td><input id = "fname" type = "text" size = "16" maxlength = "15" name = "wfname"/></td>
				<td>Wife's Last Name</td>				
				<td><input id = "fname" type = "text" size = "16" maxlength = "15" name = "wlname"/></td>
				<td>No. of Children</td>
				//this is the NumChild input..
				<td><input id = "age" type = "text" size = "16" maxlength = "3" name = "child" /></td>
				<td>No. of Family Member</td>				
				<td><input id = "fname" type = "text" maxlength = "3"  name = "famMembr"/></td>
				<td><button class = "bClose">Ok</button></td>
					
			</tr>

when i submit the form the server always return a message Dao ineIncorrect integer value: 'null' for column 'numofChild' at row 1.

here is my full Addresident.jsp form code that contains the popup

<form method = "post" action = "/SMS_System/AddResident" id = "formvalidate" name = "form1">
			<table border = "0" id = "form_table">
			<caption>Add Employed Resident</caption>
			<tr>
				<th>Personal Information
			</tr>
			<tr>
				<td>First Name</td>
				<td> <input type = "text" size = "20" maxlength = "16" name = "firstname" />
				
			</tr>
			<tr>
				<td>Middle Name 
				<td><input type = "text" size = "20" maxlength = "16" name = "midname" />
				
			</tr>
			<tr>
				<td>Last Name 
				<td><input type = "text" size = "20" maxlength = "16" name = "lastname" />
				
			</tr>
			<tr>
				<td>Address 
				<td><input type = "text" size = "20" maxlength = "16" name = "address" />
				
			</tr>
			<tr>
				<td>Occupation
				<td><input type = "text" size = "20" maxlength = "16" name = "occupation" />
			
			</tr>
			<tr>
				<td>Status 
				<td><input type = "radio" value = "single"  name = "status"/>Single
				 <input id = "married_form" type = "radio" value = "married" name = "status"/>Married
				 <input type = "radio" value = "widow" name = "status"/>Widow
			</tr>
//here is the popup input
//this only popup's if the user click the radio button named "married"
			<tr id = "Married_Form" >
			  <td>Wife's First Name</td>				
			  <td><input id = "fname" type = "text" size = "16" maxlength = "15" name = "wfname"/></td>
			  <td>Wife's Last Name</td>				
			  <td><input id = "fname" type = "text" size = "16" maxlength = "15" name = "wlname"/></td>
			  <td>No. of Children</td>				
			  <td><input id = "age" type = "text" size = "16" maxlength = "3" name = "child" /></td>
			  <td>No. of Family Member</td>				
			  <td><input id = "fname" type = "text" maxlength = "3"  name = "famMembr"/></td>
			  <td><button class = "bClose">Ok</button></td>
			</tr>
//end of popup code
			<tr>
				<td>Gender
				<td><input type = "radio" value = "male"  name = "gender"/>Male
						   <input type = "radio" value = "female" name = "gender"/>Female
			</tr>
			<tr>
				<td>Birth Date
				 <td><input type="text" id="bday" name = "mydate"  />
				
			</tr>	
			<tr>
				<td>Age
				<td><input type = "text" size = "20" maxlength = "16" name = "age" />
				
			</tr>
			<tr>
				<th>Job Information
			</tr>		
			<tr>
				<td>Employer Name
				<td><input type = "text" size = "20" maxlength = "16" name = "empname" />
				
			</tr>	
			<tr>
				<td>Company Name
				<td><input type = "text" size = "20" maxlength = "16" name = "compname" />
			</tr>	
			<tr>
				<td>Employer Address
				<td><input type = "text" size = "20" maxlength = "16" name = "empadd" />
			</tr>
			<tr>
				<td>Salary per Month
				<td><input type = "text" size = "20" maxlength = "16" name = "salary"/>
			</tr>
			<tr>
				<th>Family Information
			</tr>	
			<tr>
				<td>Father's Name
				<td><input type = "text" size = "20" maxlength = "16" name = "fatherFname" />
			</tr>
			<tr>
				<td>Father's SurName
				<td><input type = "text" size = "20" maxlength = "16" name = "fatherLname"  />
			</tr>
			<tr>
				<td>Mother's Name
				<td><input type = "text" size = "20" maxlength = "16" name = "motherFname"  />
			</tr>
			<tr>
				<td>Mother's SurName
				<td><input type = "text" size = "20" maxlength = "16" name = "motherLname" />
			</tr>
			<tr>
				<td>Number of Siblings
				<td><input type = "text" size = "20" maxlength = "16" name = "numSibling"  />
			</tr>
			<tr>
				<td>Total Number of Family Member
				<td><input type = "text" size = "20" maxlength = "16" name = "ttalfamMember"  />
			</tr>
			<tr>
				<td>
				<td><input type = "submit" value = "Submit"/>
				<input type = "reset" value = "Clear"/>
			</tr>	
		</table>	
		</form>

if you need the DAO and Servlet code for this just post in here..Thank you in advance..

Recommended Answers

All 4 Replies

well ... your
id = age
and your
name = child

where do you get the numofChild?

in my servlet named addresident.java

String wifeName = request.getParameter("wfname");
String wifeLastName = request.getParameter("wlname");
//this where i get the value of the input which has the name = "child" 
String ChildNum = request.getParameter("child");
String FamMember = request.getParameter("famMembr");

from this servlet i have a bean called wifeBEAN.java

//this are the variables that holds the values from the servlets
String fname_ID;
String Wfname;
String Wlname;
String ChildINt;
String famMem;

from this BEAN i have a DAO name dataDAO
that catches the values from the and add it to a database...

public void addWife(wifeBEAN info){
try{
        System.out.println("admin dded!!");
	st = conn.createStatement();
	st.execute("insert into res_wife values ('"+info.fname_ID+"','"+info.Wfname+"','"+info.Wlname+"','"+info.ChildINt+"','"+info.famMem+"'); ");
			
}catch(Exception e){
	System.out.println("Dao ine" +e.getMessage());
}
}

the numofChild thing is a field inside the database....

and all the other fields do get their values? have you checked for that?

yes and all the other field inside the popup also get null values...and i can't find out the cause...i'm printing out in the console the ChildNum it always print out NULL which it does not get any values from the input in the addresident.jsp

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.