This project is a web-based personal blog application built using Java Servlets, JSP, and Tomcat. It allows users to browse articles and provides an admin interface to add, edit, or delete blog posts. All articles are stored as JSON files in the filesystem. The image below illustrates the application design.
- View Articles: Browse and read articles on the blog that their publishing date is today or earlier.
- Admin Section: Add, edit, and delete blog posts through the admin interface.
- Article Management: Articles are stored in JSON format, and basic file operations (CRUD) are performed via Java code.
- Basic Authentication: Admin section is protected with basic authentication for security.
- Responsive UI: The UI is styled with CSS and provides a clean and user-friendly interface.
Home Page
Article Page
Login Page
Admin Page
New Article Page
Edit Article Page
- Java 17
- Servlets 5.0 (Jakarta)
- JSP (Jakarta Server Pages) & JSTL (Jakarta Standard Tag Library) 3.0
- Google Gson 2.11 (Handling JSON files)
- Apache Tomcat 10.1
- Maven 3.8.5
git clone https://github.com/Farnam-Hs/Personal-Blog.git
cd Personal-BlogUse Maven to build the project:
mvn clean installAdd the project to your Tomcat server in your IDE or manually.
Start the Tomcat server
Open a web browser and navigate to:
http://localhost:8080/[Context-Path] or http://localhost:8080/[Context-Path]/home
1. Viewing Articles:
- On the home page, all blog articles will be listed. Click on a title to view the full article.
2. Admin Actions:
- Navigate to the admin section using the designated admin URL
/adminor click on theLoginbutton. - Login with the correct credentials to access admin actions. (Username:
admin| Password:admin)
3. CRUD Operations:
- Add New Article: Click on the
+button in the admin section, fill in the article title, choose the publishing date, write the content, andPublish. - Edit Article: Click on the
Editbutton next to an article in the admin section, modify the title, content, or the publishing date andUpdate. - Delete Article: Click the
Deletebutton in the admin section to remove an article.
- Unauthorized Access (403): Attempting to access restricted URLs will result in a 403 Forbidden error.
- Not Found (404): : Accessing non-existent pages or malformed URLs will result in a 404 Not Found error.
- Internal Server Error (500): If an unexpected issue occurs on the server (e.g., failure in file operations or processing), a 500 Internal Server Error will be shown to the user.
Sample solution for the Personal Blog challenge from roadmap.sh.
