Hello,

I'm having a problem with INSERT statement.

There is a "ShowFinal.jsp" page, which is a list of candidates who selected from the second interview. The user picked some candidates from the list and conduct the 3rd interview. After he check suitable candidates(who are selected from the 3rd interview) from the list , enter basic salary for every selected candidate, enter date of interview and finally submit the form.

These data should be save into these tables.

FinalSelect(nicNo,date)
EmpSalary(nicNo,basicSal)

In this "ShowFinal.jsp" page, it validates the following conditions using JavaScript.

1) If the user submit the form without checking at least one checkbox, then the system should be display an alert message ("Please select at least one candidate").

2) If the user submit the form without entering the basic salary of that candidate which was checked, then the system should be display an alert message ("Please enter basic salary").

These are working well. But my problem is how to wrote the "AddNewFinal.jsp" page to save these data into the db.

Here is my code which I have wrote. But it points an error.
"AddNewFinal.jsp"
-----------------

Code:
String interviewDate = request.getParameter("date");
String[] value = request.getParameterValues("ChkNicno");
String[] bs = request.getParameterValues("basicSal");

String sql ="INSERT INTO finalselect (nicNo,date) VALUES(?,?)";
String sql2 ="INSERT INTO EmpSalary (nicNo,basicSal) VALUES(?,?)";

for(int i=0; i < value.length; i++){
	String temp = value[i];	
	for(int x=0; x < bs.length; x++){
			
		String basic = bs[x];
		pstmt2 = connection.prepareStatement(sql2);
		pstmt2.setString(1, temp);
		pstmt2.setString(2, basic);
		int RowCount1= pstmt2.executeUpdate();
	}
			
	pstmt1 = connection.prepareStatement(sql);
	pstmt1.setString(1, temp);
	pstmt1.setString(2, interviewDate);
	int RowCount= pstmt1.executeUpdate();
}
..........................................

Here is the code for "ShowFinal.jsp".

Code:
<form name="ShowFinal" method="POST" action="AddNewFinal.jsp" onsubmit="return checkEmpty() && ValidateDate();">

<%--  Loop through the list and print each item --%>
<%
	int iCounter = 0; //counter for incremental value
	while (igroups.hasNext()) {
		Selection s = (Selection) igroups.next();
		iCounter+=1; //increment
%>
<tr>
	<td style="background-color:ivory" noWrap width="20">
	<input type="checkbox" name="<%= "ChkNicno" + iCounter %>" 	value="<%=s.getNicno()%>"></td> 

   	<td style="background-color:ivory" noWrap width="39">
   		<%= s.getNicno() %>&nbsp; </td>
   		
   	.....
	.....
  	
		
	<td style="background-color:ivory" noWrap width="174">
		<input type="text" name="<%= "basicSal" + iCounter %>" size="10">&nbsp;</td>

	
</tr>
<%
   }
%>
Date of interview<input type="text" name="date" size="17"></td>

<input type="submit" value="APPROVE CANDIDATE" name="B1" style="border: 1px solid #0000FF">
</form>
........................................................
Here is the error generated by TOMCAT.

root cause

java.lang.NullPointerException
at org.apache.jsp.AddNewFinal_jsp._jspService(AddNewFinal_jsp.java:70)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)

...

I have goto the file "AddNewFinal_jsp.java". The line 70 points to the following line.

for(int i=0; i < value.length; i++){


Please can someone help me to solve this problem? Please help me to do this task.
Thanks.