0

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..

2
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by syrellNardo
0

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....

0

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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.