hi everyone

i m new to this site.....

i have problem ....... i m trying to insert data which is in jsp page int bale but it is not happening

my problem scenario is:

i have one jsp page ,in which i m displaying data from one table say table1 ,like this

bookid book refid book name book author
1 a b1 a1
1 b b2 a2
1 c b3 a3


submit button edit button

no wif user want to edit he can edit book name and book author also .and here i m getting problem.after editing and submitting only first row is getting insert on table2
which has a same structure like table 1

hi everyone

sorry for reposting but guys i need help urgently ....

i have problem ....... i m trying to insert data which is in jsp page int bale but it is not happening

my problem scenario is:

i have one jsp page ,in which i m displaying data from one table say table1 ,like this

<%try
	{

     stmt = con.createStatement();
	String strsql2 ="select auc_ref_id,item_ref_id,'MT',1,0,10,10,20 from item_master where AUC_REF_ID="+arefid;
	//out.print("auc_ref_id"+auc_ref_id);
     rsitem=stmt.executeQuery(strsql2);
  
	while(rsitem.next())
      			{
/*---------------retreiving and displaying  data from database-----------------------*/
		item_ref_id=rsitem.getString("ITEM_REF_ID");
		unit=rsitem.getString(3);
                               cunit=rsitem.getString(4);
		mmpq=rsitem.getString(5);
		emdfact=rsitem.getString(6);
		inc1=rsitem.getString(7);
		inc2=rsitem.getString(8);
				
			//for(i = 0; i < columns; i++){
			//unit[i] = rs.getString(3);
			//	}
			//	unitvect.add(unit);
    // for(i = unitvect.size()-1 ; i >=columns; i--) {
   //  out.print(unitvect.elementAt(i) );
    //          }
            
out.print("<tr>");
out.print("<td align=center>"+arefid+"</td>");
out.print("<td align=center>"+item_ref_id+"</td>");
out.print("<td align=center><input type=text name=unittext id= unittext value="+unit+"></td>");
out.print("<td align=center><input type=text name=cunittext id=cunittext value="+cunit+"></td>");
out.print("<td align=center><input type=text name=maxmpqtext id=maxmpqtext value="+mmpq+"></td>");
out.print("<td align=center><input type=text name=emdtext id=emdtext value="+emdfact+"></td>");
out.print("<td align=center><input type=text name=inc1text id=inc1text value="+inc1+"></td>");
out.print("<td align=center><input type=text name=inc2text id=inc2text value="+inc2+"></td>");
out.print("</tr>");				
		flag=flag+1;
		rowcount++;
		//out.print("rowcount"+rowcount);
				}
		/*if submit button is clicked------------*/
if (request.getParameter("confirmyes") != null)
					{



          String unittext=request.getParameter("unittext");
		  out.print("unittext"+unittext);
		  String cunittext=request.getParameter("cunittext");
		  String maxmpqtext=request.getParameter("maxmpqtext");
		  String emdtext=request.getParameter("emdtext");
		  String inc1text=request.getParameter("inc1text");
		  String inc2text=request.getParameter("inc2text");
							  		  	 try
		{
	String sql2 ="INSERT into mpq_conversionu values (?,?,?,?,?,?)";
	PreparedStatement pst = con.prepareStatement(sql2);
	pst.setString(1, arefid);
	pst.setString(2, item_ref_id);
	pst.setString(3, unittext);
	pst.setString(4, cunittext);
	pst.setString(5, maxmpqtext);
	pst.setString(6, emdtext);
	  numRowsChanged = pst.executeUpdate();
	}

	 catch (Exception e)
	{
		 out.println(e);
	 }
					}

  if(numRowsChanged!=0)
			{
                       %>
					<br>
	           <TABLE style="background-color: #E3E4FA;" 
                   WIDTH="30%" border="1">
		      <tr><th>Data is inserted successfully 
                    in database.</th></tr>
		   </table>

			<%			}


out.print("</table>");

rsitem.close();		
	}
	 catch(Exception ex)
		{
			System.out.println(ex);
		}
}
%>

submit button

no wif user want to edit he can edit the row .and here i m getting problem.after editing and submitting only first row is getting insert on table2
which has a same structure like table 1

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.