Question

Write a program using JSP and JDBC to support editing (address modification, mobile number/ email id update) of MCA 1st Semester students of IGNOU. The program should take enrollment number or registered mobile number as input. Make necessary assumptions required.

25 Jul 2024
Answer :
Word Count : 1100

To create a program using JSP (JavaServer Pages) and JDBC (Java Database Connectivity) for editing the details (address modification, mobile number/email ID update) of MCA 1st Semester students of IGNOU, we need to set up a web application that allows students to update their information based on their enrollment number or registered mobile number. Below are the steps and the necessary code snippets to achieve this.

### Assumptions
1. A MySQL database named `ignou` with a table `students` exists.
2. The `students` table has the following structure:
   ```sql
   CREATE TABLE students (
       id INT AUTO_INCREMENT PRIMARY KEY,
       enrollment_number VARCHAR(20) UNIQUE,
       name VARCHAR(100),
       address VARCHAR(255),
       mobile_number VARCHAR(15),
       email_id VARCHAR(100)
   );
   ```
3. The database is hosted on `localhost` with the username `root` and password `password`.

### Steps to Create the Program

1. Database Connection Setup
   Create a utility class `DBConnection.java` to handle database connections.
   
   ```java
   import java.sql.Connection;
   import java.sql.DriverManager;
   import java.sql.SQLException;

   public class DBConnection {
       public static Connection getConnection() throws SQLException {
           String url = "jdbc:mysql://localhost:3306/ignou";
           String username = "root";
           String password = "password";
           return DriverManager.getConnection(url, username, password);
       }
   }
   ```

2. JSP Page for Input
   Create an `editStudent.jsp` page to take the enrollment number or registered mobile number as input.

   ```jsp
   <!DOCTYPE html>
   <html>
   <head>
       <title>Edit Student Details</title>
   </head>
   <body>
       <h2>Edit Student Details</h2>
__________ _________ __________ _________ __________ ________.
___ ___ ____ _____ _______ _________ _________ ___.
___ ________ ____ ________ ________ ___ ______ _________ ________.
__________ ____ ______ ___ ________.
___ _________ _______ ___ __________ ___ _____ _______.
_______ _________ ________ ___ ___ ________ _________ ________.
______ ___ _______ ________ ________ _____ ______ ___.
____ ____ _________ _______ __________.
________ _______ ______ _______ __________ ___ ________ ___.
__________ _______ _____ __________ ____ _______ _________ __________ ________ __________ ______ ____.
___ ________ ____ ________ ____ ________ __________ _____ ___ _______.
_____ __________ ___ ____ _________ ________ _______ ________ _________.
__________ _________ ______ _________ ____ ____ _____ __________ ________ __________.
___ ______ _______ ________ ______ ___ __________ ____ __________ __________ ___ _____.
_________ _________ ________ ___ _____ _______ ________ __________ ________.
__________ ____ _________ ________ ________ _____ ________ _____ _______.
_______ __________ ____ _____ ____ ____ __________.
______ _________ ________ ________ ________ __________ __________ ____ ________ _________.
___ ___ ______ ____ __________ ___ _____ ________ _____ _______.
___ __________ _______ _____ __________ ______ ______.
_________ ______ ________ ____ _____ ________ __________ _____ __________ _____ ___ ______.
________ ___ ____ ___ ______ _____ ______ _________.
_____ _____ ____ _________ ________ _____ ___ _________.
_______ _________ ____ ___ _______ __________ __________ __________ _____.
______ ________ ______ ____ _______ _______.
____ ________ _________ _______ ____ _____ _______.
_______ _________ _______ ____ _____ __________ __________ _____.
__________ ____ ________ ___ ________ ___.
___ ______ ___ ________ _____ ________ ________ _______.
__________ _________ _____ _________ ____ __________ ________.
______ __________ _____ ____ ______ _______ ____ ________.
_____ ________ ____ _______ __________ ___ _________ ____ __________.
_______ ___ _____ _____ __________ _______ _______.
_____ _____ ____ ______ ______ __________ ______ _______ _________.
______ ________ ______ ____ ______ ________ ________ ____ ___ _______.
_____ ___ __________ _______ _________.
____ _______ __________ _______ _______.
_______ ________ ________ ______ _________ ___ ________.
____ ________ ________ _________ _____ ___.
________ ________ __________ ____ _______ _______.
_________ _____ ___ __________ ______ ______ _________ ______ ______ ______ _________ ___.
___ ____ ____ __________ ________ ________ __________ ____ ___ ______.
_____ _____ _______ ____ ____ _______ ______ ______ _________ ____.
______ _________ _______ __________ _________ ________ ________ _________ ____ _________ __________ ______.
_________ ___ ______ ________ ______ _______ _____.
_________ _________ _________ __________ __________ _______ ______ ___ ________ ___.
_________ ___ ________ ________ ___ _______ ____ ________ ______ ________.
_____ ____ ___ __________ _________ _______ _____.
____ __________ _______ ____ _____ _______ ________ _____.
__________ ______ ______ _________ __________ ______.
________ ________ ________ _________ ______ _________ ____.
______ _____ ______ _____ _____.
___ ____ _________ __________ _________.
______ ________ _____ ____ ________ ________ _____.
_____ ________ ________ _________ ______ ___ ______ ______ _______ ___.
___ ____ _________ __________ _____ ____ __________.
_____ ___ ______ __________ _____ _________ _____ ___ ______ ________ ____.
______ ___ _____ _________ __________ ________ ________ _________ _______.
_________ __________ ____ _______ _____ ______ ___ _____ _______ _______ __________ ____.
___ _________ ____ ___ _____ _______ _____ _____ ____.
_________ __________ ________ ___ ____ _______ _____ ___ ____ _______ ________ __________.
__________ ______ __________ ______ ___ __________ ____ ___ ____ ______ ____ ___.
____ ____ ______ ____ ________ ________ ____ _________ _____ ____ ___ ______.
_____ ________ ___ ____ ____ ____ _______ ______.
______ ___ _________ ______ ____ _____ __________ __________ ____ __________ ______ _______.
___ _________ ______ _________ ________ ___ _______ _______ ____ __________ __________.
____ ____ _______ ___ ___ __________.
_______ ____ _____ _________ _______ _____ _________.
______ _________ ________ ___ ___ ___ __________ _____.
_____ ________ ____ _______ _____ ____.
______ ________ ____ __________ ___ _______ ________.
_____ ________ ____ __________ _____ ____ ______ _______ _________ _________.
___ ___ __________ ______ ____ _____ _________ _______ _______ ____ _____.
____ ____ _______ _____ ____ ________ ______.
____ ______ _____ __________ _______ ____ ___ ________ ___ _________ __________ _____.
________ _____ ________ ___ ________ __________.
________ ______ _______ _____ __________ ____ ____ _____.
____ ___ ______ ________ ___ _____ _________ __________ ________ _______.
___ _____ ________ ___ ____ ____ ____ ________.
___ _______ ________ _____ ____.
_____ _____ _____ ______ _________ ____ ___.
____ ____ ___ ______ _______ ______ ________ _________ _______ _______ _____ _____.
_____ _____ _____ ______ _______ _________ ____ ____ ___ _________ ________.
____ ___ ____ ______ _______ ____ ________ _________ ____ ___.
__________ _____ _____ ____ _____ ______ _________ _____ _________ ____ _________.
_______ _____ _____ ____ ________ _______ ____ ___.
______ _________ ___ __________ _____ _______.
_______ ________ __________ ________ ________.
_____ ______ ____ ___ _______ ______.
________ _________ __________ _______ __________ ___ ___ ___ _____ _____ ____ ________.
_______ ____ ________ ________ ___.
______ __________ ____ ______ ______ __________ ___.
_____ _____ ________ _____ ___ ______ _______ ____.

IGNOU ACADEMY
Your IGNOU journey, made easier.
  • Solved Assignments
  • Study Notes
  • Guess Papers
  • Question Papers
Skip in 10
Top