Admin Page To update Result using JSP(Project:1) - NESTED CODE || TECH FLOAT

Breaking

Post Top Ad

Post Top Ad

Sunday, 11 November 2012

Admin Page To update Result using JSP(Project:1)

Now the question is how the result will be updated in the table. Well, we can do this from the back end but here we will make a Gui interface for Admin, remember it is admin side page for this small project.
So the code for this page ::

<%-- 
    Document   : welcome
    Created on : 3 Nov, 2012, 7:57:13 PM
    Author     : Nested code
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Admin Page</title>
    </head>
    <body>
         <%@ page language="java" %>
        <%@ page import="java.sql.*" %>
         <%@ page import="java.sql.DriverManager.*" %>
        <center>
            <h1><b>NESTEDCODE.BLOGSPOT.COM | Admin Page</b></h1><p>
            User Login <blink><a href="login.jsp">Click Here</a></blink>
            <hr>
                <form action="admin.jsp">
                <br><b>Login ID<input type="text" name="id"></b>
                <br><b>Marks<input type="text" name="marks"></b>
                 <br><b>Percent<input type="text" name="percent"></b>
                 <br><b>Gread<input type="text" name="gread"></b>
                <br>
                    <input type="submit" value="Update Result">
                </form><br>
                <h1> Registered Userd </h1>
              <table border="1">
               <tr>
                   <td>Name</td>
                  
                  
                   <td>ID</td>
                  
                 
                   <td>password</td>
                   <td>Date of Birth</td>
                   <td>Address</td>
                 
                   </tr>
                    
                 <%
        String m=null, mn=null,dmn=null,mar=null,per=null,gre=null,gre1=null;
       String s=request.getParameter("id");
       // String s1=request.getParameter("id");
        //String s2=request.getParameter("date");
        PreparedStatement ps=null;
        Connection con= null;
        ResultSet rs= null;
        ResultSet rs1= null;
       Class.forName("oracle.jdbc.driver.OracleDriver");
        con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","summer3");
      
         Statement st=con.createStatement();
       
           rs=st.executeQuery("select * from register");
          // rs1=st.executeQuery("select * from result");
          
         
    
           while(rs.next())
               {
            
              ////  gre=rs.getString(6);
              
          %>
           <tr>
                       
                   <td><% out.println(rs.getString(1));  %></td>
                    <td><% out.println(rs.getString(2));  %></td>
                     <td><% out.println(rs.getString(3));  %></td>
                     <td><% out.println(rs.getString(4));  %></td>
                     <td><% out.println(rs.getString(5));  %></td>
                   
                   </tr><% } %>
               </table><hr>
            <h1> Result Updated Table</h1>
              <table border="1">
               <tr>
                   <td>Marks</td>
                  
                  
                   <td>Percent</td>
                  
                 
                   <td>Gread</td>
                   <td>ID</td>
                 
                 
                   </tr>
           <% rs1=st.executeQuery("select * from result");
            while(rs1.next())
               {
            
              ////  gre=rs.getString(6);
              
          %>
           <tr>
                       
                   <td><% out.println(rs1.getString(1));  %></td>
                    <td><% out.println(rs1.getString(2));  %></td>
                     <td><% out.println(rs1.getString(3));  %></td>
                     <td><% out.println(rs1.getString(4));  %></td>
                   
                   
                   </tr><% } %>
               </table>
          
           
            </center>
    </body>
</html>


The out put is like::


Here the admin easily can update each and every registered user's result. That is all about our 1st project.  See you in the next blog. If you have any problem discus at comment box. Thank You.

Previous Lesson 

4 comments:

  1. sir this code has no effect in database....result is not updated after filling the values in textboxes..
    it shows only the previously entered values in db on the admin.jsp page..
    how it will work correct??

    ReplyDelete
    Replies
    1. You have to check whole project. Ready each every page care fully. Any problem mail us. Send You the whole project then.

      Delete
  2. how to modify already inserted record plz tell me....
    my mail id is arasu9113@gmail.com

    ReplyDelete
  3. I want result table for database plz send it to me my mail Id rupee514@gmail.com

    ReplyDelete

Post Bottom Ad