Skip to content

shuaiting-li/WebNote

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

110 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

WebNote

A web-based note management application built with Java, Servlets, and JSP. WebNote allows users to create, organize, search, and manage notes with rich content including text and images.

Screenshot 2025-03-13 at 12 47 52

πŸ“‹ Table of Contents

✨ Features

  • Note Management: Create, edit, view, and delete notes with rich content
  • Category Organization: Organize notes into custom categories
  • Rich Content Support:
    • Text content
    • Image uploads
    • URL attachments
  • Search Functionality: Search notes by keyword and filter by category
  • Persistent Storage: JSON-based file storage system
  • Responsive Web Interface: Clean and intuitive user interface built with JSP
  • Embedded Tomcat Server: Built-in server for easy deployment

πŸ›  Technologies

  • Java 23: Core programming language
  • Apache Tomcat 11.0.4: Embedded web server
  • JSP 4.0.1: Server-side templating
  • Maven: Build automation and dependency management
  • Jackson: JSON processing for data persistence
  • Servlets: Backend request handling
  • HTML/CSS: Frontend presentation

πŸ“ Project Structure

WebNote/
β”œβ”€β”€ src/
β”‚   └── main/
β”‚       β”œβ”€β”€ java/uk/ac/ucl/
β”‚       β”‚   β”œβ”€β”€ main/
β”‚       β”‚   β”‚   └── Main.java                 # Application entry point
β”‚       β”‚   β”œβ”€β”€ model/
β”‚       β”‚   β”‚   β”œβ”€β”€ Note.java                 # Note entity
β”‚       β”‚   β”‚   β”œβ”€β”€ NoteContent.java          # Content model
β”‚       β”‚   β”‚   β”œβ”€β”€ NoteService.java          # Business logic service
β”‚       β”‚   β”‚   β”œβ”€β”€ NoteRepository.java       # Repository interface
β”‚       β”‚   β”‚   β”œβ”€β”€ JsonNoteRepository.java   # JSON persistence implementation
β”‚       β”‚   β”‚   β”œβ”€β”€ NoteFactory.java          # Note creation factory
β”‚       β”‚   β”‚   └── NoteSearch.java           # Search functionality
β”‚       β”‚   └── servlets/
β”‚       β”‚       β”œβ”€β”€ CreateNoteServlet.java    # Create new notes
β”‚       β”‚       β”œβ”€β”€ SaveNoteServlet.java      # Save note updates
β”‚       β”‚       β”œβ”€β”€ NoteServlet.java          # View note details
β”‚       β”‚       β”œβ”€β”€ SearchServlet.java        # Search notes
β”‚       β”‚       β”œβ”€β”€ UploadImageServlet.java   # Handle image uploads
β”‚       β”‚       β”œβ”€β”€ ManageCategory.java       # Category management
β”‚       β”‚       └── ...                       # Other servlets
β”‚       └── webapp/
β”‚           β”œβ”€β”€ index.jsp                     # Home page
β”‚           β”œβ”€β”€ note.jsp                      # Note detail view
β”‚           β”œβ”€β”€ noteList.jsp                  # List all notes
β”‚           β”œβ”€β”€ search.jsp                    # Search page
β”‚           β”œβ”€β”€ searchResult.jsp              # Search results
β”‚           β”œβ”€β”€ styles.css                    # Stylesheets
β”‚           └── WEB-INF/
β”‚               └── web.xml                   # Web application config
β”œβ”€β”€ data/
β”‚   β”œβ”€β”€ index.json                            # Note index
β”‚   β”œβ”€β”€ categoryCollection.json               # Categories
β”‚   β”œβ”€β”€ notes/                                # Individual note files
β”‚   └── images/                               # Uploaded images
β”œβ”€β”€ pom.xml                                   # Maven configuration
└── README.md                                 # This file

πŸ“‹ Prerequisites

  • Java Development Kit (JDK) 23 or higher
  • Apache Maven 3.6+
  • Git (for cloning the repository)

πŸš€ Installation

  1. Clone the repository

    git clone https://github.com/spicyGrape/WebNote.git
    cd WebNote
  2. Build the project

    mvn clean install

    This will:

    • Compile the Java source files
    • Process resources
    • Run tests (if any)
    • Package the application as a WAR file in war-file/ directory

▢️ Running the Application

Option 1: Using Maven Exec Plugin

mvn exec:exec

Option 2: Run the Main class directly

mvn compile
java -cp target/classes uk.ac.ucl.main.Main

The application will start an embedded Tomcat server and be accessible at:

http://localhost:8080

To stop the server, press Ctrl+C in the terminal.

πŸ’‘ Usage

Creating a Note

  1. Navigate to the home page
  2. Click "Create New" or go to /createNote.html
  3. Add a title and content (text, images, URLs)
  4. Save the note

Organizing with Categories

  1. Create a new category from the category management page
  2. Assign notes to categories
  3. Filter notes by category

Searching Notes

  1. Go to the Search page
  2. Enter keywords
  3. Optionally filter by category
  4. View matching results

Uploading Images

  1. Open or create a note
  2. Use the image upload feature
  3. Images are stored in data/images/

πŸ”Œ API Endpoints

Note Management

  • GET /noteList.html - View all notes
  • GET /createNote.html - Create note form
  • POST /createNote - Create new note
  • GET /note.html?id={noteId} - View specific note
  • POST /saveNote - Save note updates
  • POST /deleteNote - Delete note

Content Management

  • POST /uploadImage - Upload image
  • POST /uploadUrl - Add URL content
  • POST /deleteContent - Delete note content

Category Management

  • POST /manageCategory - Create/delete categories
  • POST /addRemoveNoteToCategory - Add/remove note from category

Search

  • GET /search.html - Search page
  • POST /search - Perform search

Images

  • GET /image?fileName={fileName} - Serve uploaded images

πŸ’Ύ Data Storage

WebNote uses a JSON-based file system for data persistence:

  • index.json: Master index of all notes
  • categoryCollection.json: Category definitions and note assignments
  • notes/*.json: Individual note files with full content
  • images/: Uploaded image files

All data is stored in the data/ directory at the project root.

πŸ”§ Development

Building for Production

mvn clean package

This creates a WAR file in war-file/ that can be deployed to any servlet container.

Project Configuration

Key configuration in pom.xml:

  • Java version: 23
  • Tomcat version: 11.0.4
  • JSP version: 4.0.1
  • Main class: uk.ac.ucl.main.Main

Logging

Application logs are written to logfile.txt in the project root.

πŸ“ Notes

  • This project was originally developed as coursework for COMP0004 Object-Oriented Programming at UCL
  • The application uses an embedded Tomcat server for easy development and deployment
  • Data is persisted as JSON files in the data/ directory

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“„ License

This project is part of academic coursework. Please check with the repository owner for usage rights.

πŸ‘€ Author

spicyGrape


Happy Note-Taking! πŸ“

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Java 91.0%
  • CSS 9.0%