0% found this document useful (0 votes)
10 views5 pages

SM Program

The document outlines the structure and components of a Student Management System, including its directory layout and key Java servlets for managing students, marks, and leaderboards. It describes the functionality of each servlet, such as inserting, updating, deleting, and retrieving student data and marks. Additionally, it includes CSS for styling and JavaScript for form validation, along with the web.xml configuration for servlet mapping.

Uploaded by

Rutuja Sabade
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views5 pages

SM Program

The document outlines the structure and components of a Student Management System, including its directory layout and key Java servlets for managing students, marks, and leaderboards. It describes the functionality of each servlet, such as inserting, updating, deleting, and retrieving student data and marks. Additionally, it includes CSS for styling and JavaScript for form validation, along with the web.xml configuration for servlet mapping.

Uploaded by

Rutuja Sabade
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 5

STUDENT MANAGEMENT SYSTEM

Project Structure :

StudentManagement/

├── src/
│ ├── main/
│ │ ├── java/
│ │ │ └── com/
│ │ │ └── studentmanagement/
│ │ │ ├── controller/
│ │ │ │ ├── StudentServlet.java
│ │ │ │ ├── MarkServlet.java
│ │ │ │ └── LeaderboardServlet.java
│ │ │ ├── model/
│ │ │ │ ├── Student.java
│ │ │ │ ├── Marks.java
│ │ │ │ └── Ledger.java
│ │ │ └── dao/
│ │ │ ├── StudentDAO.java
│ │ │ ├── MarksDAO.java
│ │ │ └── LedgerDAO.java
│ │ └── resources/
│ │ └── application.properties
│ └── webapp/
│ ├── WEB-INF/
│ │ └── web.xml
│ ├── css/
│ │ └── styles.css
│ ├── js/
│ │ └── scripts.js
│ └── views/
│ ├── index.jsp
│ ├── addStudent.jsp
│ ├── updateStudent.jsp
│ ├── viewMarks.jsp
│ ├── viewStudent.jsp
│ └── leaderboard.jsp
└── pom.xml

1. StudentServlet.java
java
@WebServlet("/student")
public class StudentServlet extends HttpServlet {
private StudentDAO studentDAO;

@Override
public void init() throws ServletException {
studentDAO = new StudentDAO();
}

protected void doPost(HttpServletRequest request, HttpServletResponse response)


throws ServletException, IOException {
String action = request.getParameter("action");

switch (action) {
case "insert":
insertStudent(request, response);
break;
case "update":
updateStudent(request, response);
break;
case "delete":
deleteStudent(request, response);
break;
case "retrieve":
retrieveStudent(request, response);
break;
}
}

private void insertStudent(HttpServletRequest request, HttpServletResponse


response)
throws ServletException, IOException {
// Implementation for inserting student data
}

private void updateStudent(HttpServletRequest request, HttpServletResponse


response)
throws ServletException, IOException {
// Implementation for updating student data
}

private void deleteStudent(HttpServletRequest request, HttpServletResponse


response)
throws ServletException, IOException {
// Implementation for deleting student data
}

private void retrieveStudent(HttpServletRequest request, HttpServletResponse


response)
throws ServletException, IOException {
// Implementation for retrieving student data
}
}

2. MarkServlet.java
java
@WebServlet("/marks")
public class MarkServlet extends HttpServlet {
private MarksDAO marksDAO;

@Override
public void init() throws ServletException {
marksDAO = new MarksDAO();
}

protected void doPost(HttpServletRequest request, HttpServletResponse response)


throws ServletException, IOException {
String action = request.getParameter("action");

switch (action) {
case "insert":
insertMarks(request, response);
break;
case "update":
updateMarks(request, response);
break;
case "delete":
deleteMarks(request, response);
break;
case "retrieve":
retrieveMarks(request, response);
break;
}
}

private void insertMarks(HttpServletRequest request, HttpServletResponse


response)
throws ServletException, IOException {
// Implementation for inserting marks
}

private void updateMarks(HttpServletRequest request, HttpServletResponse


response)
throws ServletException, IOException {
// Implementation for updating marks
}

private void deleteMarks(HttpServletRequest request, HttpServletResponse


response)
throws ServletException, IOException {
// Implementation for deleting marks
}

private void retrieveMarks(HttpServletRequest request, HttpServletResponse


response)
throws ServletException, IOException {
// Implementation for retrieving marks
}
}

3. LeaderboardServlet.java
java
@WebServlet("/leaderboard")
public class LeaderboardServlet extends HttpServlet {
private LedgerDAO ledgerDAO;

@Override
public void init() throws ServletException {
ledgerDAO = new LedgerDAO();
}

protected void doGet(HttpServletRequest request, HttpServletResponse response)


throws ServletException, IOException {
String action = request.getParameter("action");

switch (action) {
case "topFive":
retrieveTopFive(request, response);
break;
case "topFiveGirls":
retrieveTopFiveGirls(request, response);
break;
case "topFiveBoys":
retrieveTopFiveBoys(request, response);
break;
}
}

private void retrieveTopFive(HttpServletRequest request, HttpServletResponse


response)
throws ServletException, IOException {
// Implementation for retrieving the top five students
}

private void retrieveTopFiveGirls(HttpServletRequest request,


HttpServletResponse response)
throws ServletException, IOException {
// Implementation for retrieving the top five girls
}

private void retrieveTopFiveBoys(HttpServletRequest request,


HttpServletResponse response)
throws ServletException, IOException {
// Implementation for retrieving the top five boys
}
}

4. CSS (styles.css)
css
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
}

.container {
width: 80%;
margin: auto;
overflow: hidden;
}

button {
background-color: #333;
color: #fff;
border: none;
padding: 10px;
cursor: pointer;
}

button:hover {
background-color: #555;
}

JavaScript (scripts.js)
javascript
function validateForm() {
// Implementation of form validation
}

5. web.xml
xml
<web-app>
<servlet>
<servlet-name>StudentServlet</servlet-name>
<servlet-class>com.studentmanagement.controller.StudentServlet</servlet-
class>
</servlet>
<servlet-mapping>
<servlet-name>StudentServlet</servlet-name>
<url-pattern>/student</url-pattern>
</servlet-mapping>

<servlet>
<servlet-name>MarkServlet</servlet-name>
<servlet-class>com.studentmanagement.controller.MarkServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>MarkServlet</servlet-name>
<url-pattern>/marks</url-pattern>
</servlet-mapping>

<servlet>
<servlet-name>LeaderboardServlet</servlet-name>
<servlet-class>com.studentmanagement.controller.LeaderboardServlet</
servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>LeaderboardServlet</servlet-name>
<url-pattern>/leaderboard</url-pattern>
</servlet-mapping>
</web-app>

You might also like