Implement batch update of data through JSP

Source: Internet
Author: User
Tags implement integer reference
js| data
I have a program, I do not know if I can help you!!
<--
This is the a1.jsp page program
-->
<jsp:usebean id= "Pool" scope= "page" class= "Sql_link.sql_link"/>//Reference database connection Bean
<link rel= "stylesheet" type= "Text/css" href= "Main.css" >
<title>Untitled</title>
<body>
<form name=f1 action= "a2.jsp" method= "POST" >
<table>
<%resultset rs = null;
int i=0;
Rs=pool. Query ("Select ID, Name, gender from database name");
while (Rs.next ())
{
i++;
String tax= "Ta" +string.valueof (i);
String tbx= "TB" +string.valueof (i);
String tcx= "TC" +string.valueof (i);
%>
<tr>
<td>
<input type=hidden name= "<%=tcx%>" value= "<%rs.getint (1)%>" >
<input type=text name= "<%=tax%>" value= "<%=rs.getstring (2)%>" >
</td>
<td>
<input type=text name= "<%=tbx%>" value= "<%=rs.getstring (3)%>" >
</td>
</tr>
<%
}
%>
<input type=hidden name=hh value= "<%=i%>" >
</table>
</form>
</body>
//------------------------------------------------------------------------------
A2.jsp accepts the data from the a1.jsp page and stores it in the database!!
<jsp:usebean id= "Pool" scope= "page" class= "Sql_link.sql_link"/>//Reference database connection Bean
<link rel= "stylesheet" type= "Text/css" href= "Main.css" >
<title>Untitled</title>
<body>
<%
int Key=integer.parseint (Request.getparameter ("hh"));
for (int i=1;i<=key;i++)
{String tax= "ta" +string.valueof (i);
String tbx= "TB" +string.valueof (i);
String tcx= "TC" +string.valueof (i);
int Id=integer.parseint (Request.getparameter (TCX));
String xm=request.getparameter (tax);
String Xb=reqquest.getparameter (TBX);
Pool. Update ("Update database name Set name =´" +xm+ "´, gender =´" +xb+ "´where id=" +id+ ");
}
Pool.close ();
%>
</body>
That's OK!!





Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.