A comprehensive Java web application project designed for students learning web development. This project implements a Todo list manager using Java Servlets, JSP, and MySQL, providing hands-on experience with core web technologies.
- Understanding MVC architecture in Java web applications
- Working with Servlets and JSP
- Database operations using JDBC
- Web application deployment
- Basic CRUD operations
Before starting, ensure you have:
- JDK 8 or higher installed
- Apache Tomcat 8.5 or higher
- MySQL Server 5.7 or higher
- IDE (Eclipse/IntelliJ IDEA)
- Git
git clone https://github.com/v-eenay/simple-todo-app-java.git
cd simple-todo-app-javaTo set up the database for this application:
-
Make sure you have MySQL installed and running
-
Run the SQL script located in
sql/todo_database.sqlto create the database and tables:mysql -u root < sql/todo_database.sql(If your MySQL has a password, use
mysql -u root -p < sql/todo_database.sql) -
The script will:
- Create the
todo_databaseif it doesn't exist - Create the required
todo_tablewith all necessary fields - Insert some sample data (optional)
- Create the
- Navigate to
src/main/java/com/todo/model/TodoDAO.java - Update the following properties:
private static final String URL = "jdbc:mysql://localhost:3306/todo_database";
private static final String USER = "your_username";
private static final String PASSWORD = "your_password";- Ensure Maven is installed on your system
- Navigate to project directory
- Run
mvn clean install - Add the following dependencies to pom.xml:
- javax.servlet-api
- mysql-connector-java
- jstl
- junit
- Create a new Dynamic Web Project
- Add the following JARs to WEB-INF/lib:
- javax.servlet-api-3.1.0.jar
- mysql-connector-java-8.0.27.jar
- jstl-1.2.jar
- Configure build path to include these JARs
- Window → Show View → Servers
- Right-click → New → Server
- Choose Apache → Tomcat v8.5
- Set server location to your Tomcat installation
- Add the project to the server
todo-application/
├── src/
│ ├── main/
│ │ ├── java/
│ │ │ ├── com/todo/
│ │ │ │ ├── controller/
│ │ │ │ │ ├── AddTodoServlet.java
│ │ │ │ │ ├── DeleteTodoServlet.java
│ │ │ │ │ └── ListTodoServlet.java
│ │ │ │ └── model/
│ │ │ │ ├── TodoModel.java
│ │ │ │ └── TodoDAO.java
│ │ ├── webapp/
│ │ │ ├── WEB-INF/
│ │ │ │ └── web.xml
│ │ │ ├── views/
│ │ │ │ ├── add-todo.jsp
│ │ │ │ └── list-todo.jsp
│ │ │ ├── assets/
│ │ │ │ └── css/
│ │ │ │ └── styles.css
│ │ │ │
│ │ │ └── index.jsp
│ └── test/
└── pom.xml
public class TodoModel {
private int id;
private String title;
private String description;
private boolean completed;
// Add getters, setters, constructors
}public class TodoDAO {
// Database operations
public static int addTodo(TodoModel todoModel);
public static ArrayList<TodoModel> listTodos();
public static boolean deleteTodo(TodoModel todoModel);
}- AddTodoServlet.java: Handle todo creation
- DeleteTodoServlet.java: Handle todo deletion
- ListTodoServlet.java: Display todos
- index.jsp: Landing page
- add-todo.jsp: Add new todo
- list-todo.jsp: Display all todos
- Start Tomcat server
- Access application at
http://localhost:8080/todo-application - Test following features:
- Adding new todo
- Listing todos
- Deleting todo
Students can enhance the project by adding:
-
User Authentication
- Login/Register functionality
- User-specific todos
- Session management
-
Todo Features
- Todo categories/tags
- Priority levels
- Due date notifications
- Status tracking
-
UI Enhancements
- Responsive design
- Dark/Light theme
- Search and filter todos
- Sorting options
-
API Integration
- RESTful API endpoints
- JSON response format
- API documentation
- Fork the repository
- Create your feature branch (
git checkout -b feature/NewFeature) - Implement your feature
- Follow existing code structure
- Add appropriate comments
- Include unit tests
- Commit changes (
git commit -m 'Add NewFeature') - Push to branch (
git push origin feature/NewFeature) - Open a Pull Request with detailed description
Vinay Koirala
Lecturer, Itahari International College
- Check the Issues section
- Contact: binaya.koirala@iic.edu.np
- Create: Add new todo items
- Read: View all todo items
- Update: Edit existing todo items
- Delete: Remove todo items