Today you are going to learn how t update using parameters in jsp page.This simple example uses mysql you can use your own database..
First create a form named form.html
Quote:<form name="simple" action="updb.jsp" method="get" >
<input type="text" name="paramone"/>
<input type="text" name="paramtwo"/>
<input type="submit" />
<form/>
Next create updb.jsp
<%@ page import="java.sql.*"%>
<%
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://localhost/way2start","root","root");
Statement st=con.createStatement();
Statement st1=con.createStatement();
String two=request.getParameter("paramone");
String twomodify=request.getParameter("paramtwo");
st.executeUpdate("update one set name='"+two+"' where (name='"+twomodify+"')");
ResultSet rs=st1.executeQuery("select * from one");
while(rs.next())
{
out.println("<html>");
out.println("<body>");
out.println("<table bgcolor='green'>");
out.println("<tr>");
out.println("<td>");
out.println(rs.getString(1));
out.println("</td>");
out.println("</tr>");
out.println("</table>");
out.println("</body>");
out.println("</html>");
}
%>
The url pass like this
//http://localhost:8084/ImporterandExporter/update.jsp?name=safiq&name1=safiq1
Tutorial Provided by In order to view links, you must have to reply to this thread. Visit for More Tutorials
Any doubt ask us.
Happy coding