Click here to Skip to main content
15,890,609 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
XML
<%@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>




this is my code. I want to edit the selected id and update it. but i am not even able to display them in textbox. So please anyone help me out.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900