<%@page contentType="text/html" pageEncoding="UTF-8"%> <%@ page import="java.io.*,java.util.*,java.sql.*"%> <%@ page import="javax.servlet.http.*,javax.servlet.*" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%> <html> <head> <title>SELECT Operation</title> </head> <body> <sql:setDataSource var="snapshot" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/mysql" user="root" password="root"/> <sql:query dataSource="${snapshot}" var="result"> SELECT * from user_reg_ml; </sql:query> <table border="1" > <tr> <th>ID</th> <th>Name</th> <th>Email</th> <th>Country</th> </tr> <c:forEach var="row" items="${result.rows}"> <tr> <td><c:out value="${row.id}"/></td> <td><c:out value="${row.uname}"/></td> <td><c:out value="${row.email}"/></td> <td><c:out value="${row.country}"/></td> </tr> </c:forEach> </table> <b> Enter id you want to edit :</b> <input type="text" name="txtsearchid" value="" /> <br/> <input type="button" value="Search"/> <sql:setDataSource var="snapshot" driver="com.mysql.jdbc.Driver url="jdbc:mysql://localhost:3306/mysql" user="root" password="root"/> <sql:query dataSource="${snapshot}" var="result"> SELECT * from user_reg_ml where id='"+ txtsearchid +"'; </sql:query> <c:forEach var="row" items="${res.rows}"> Id: <input type="text" name="id" value="${row.id}" ><br/> Name: <input type="text" name="name" value="${row.uname}"><br/> Email: <input type="text" name="email" value="${row.email}"><br/> Country :<input type="text" name="country" value="${row.country}"><br/> </c:forEach> <input type="submit" value="update"> </body> </html>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)