Code Lens News là một hệ thống quản lý tin tức hiện đại được xây dựng bằng Java Servlet/JSP, cung cấp đầy đủ chức năng cho việc xuất bản, quản lý và chia sẻ tin tức. Hệ thống hỗ trợ 3 vai trò người dùng: Admin, Reporter và User với các quyền hạn khác nhau.
- Admin: Quản lý toàn bộ hệ thống, duyệt tin, quản lý người dùng
- Reporter: Viết bài, quản lý tin của mình
- User: Xem tin tức, đăng ký nhận tin
- ✅ Tạo/Sửa/Xóa bài viết
- ✅ Duyệt tin (Admin)
- ✅ Phân loại theo danh mục
- ✅ Upload hình ảnh
- ✅ Tìm kiếm và lọc tin
- ✅ Thống kê lượt xem
- ✅ Newsletter tự động
- ✅ Thông báo tin mới
- ✅ Gửi email khi duyệt tin
- ✅ Quản lý danh sách đăng ký
- ✅ Responsive design
- ✅ Modern UI với CSS Variables
- ✅ Dark/Light theme
- ✅ Mobile-friendly
code-lens-new/
├── src/main/java/com/codelensnew/
│ ├── controller/ # Controllers (MVC)
│ │ ├── admin/ # Admin controllers
│ │ ├── reporter/ # Reporter controllers
│ │ ├── user/ # User controllers
│ │ └── auth/ # Authentication
│ ├── dao/ # Data Access Objects
│ │ ├── impl/ # DAO implementations
│ │ └── *.java # DAO interfaces
│ ├── entity/ # Entity classes
│ ├── utils/ # Utility classes
│ └── filter/ # Servlet filters
├── src/main/webapp/
│ ├── views/ # JSP pages
│ │ ├── layouts/ # Layout templates
│ │ ├── components/ # Reusable components
│ │ └── pages/ # Page templates
│ ├── css/ # Stylesheets
│ ├── images/ # Static images
│ └── WEB-INF/ # Web configuration
└── src/main/resources/ # Resources & SQL scripts
- SQL Server với 4 bảng chính:
USERS- Thông tin người dùngCATEGORIES- Danh mục tin tứcNEWS- Bài viết tin tứcNEWSLETTERS- Danh sách đăng ký nhận tin
- Java 17+
- Maven 3.6+
- SQL Server 2019+
- Tomcat 10+ (hoặc servlet container tương đương)
-- Tạo database
CREATE DATABASE CodeLensNew;
-- Chạy các script SQL trong thư mục src/main/resources/
-- V1__init_schema.sql
-- V2__insert_categories.sql
-- V3__insert_users.sql
-- V4__insert_data_table_news.sql
-- V5__insert_newsletter_data.sql
-- V6__insert_sample_news.sqlSửa file src/main/java/com/codelensnew/utils/JdbcHelper.java:
private static final String URL = "jdbc:sqlserver://localhost:1433;databaseName=CodeLensNew;...";
private static final String USERNAME = "your_username";
private static final String PASSWORD = "your_password";Sửa file src/main/java/com/codelensnew/utils/Mailer.java:
String username = "[email protected]";
String password = "your_app_password";# Build project
mvn clean package
# Deploy WAR file vào Tomcat
# Copy target/code-lens-new.war vào webapps/- Import project vào IDE
- Cấu hình Tomcat server
- Run on Server
- Trang chủ:
http://localhost:8080/code-lens-new/ - Admin:
http://localhost:8080/code-lens-new/admin/ - Reporter:
http://localhost:8080/code-lens-new/reporter/
- Username:
admin - Password:
admin123
- Username:
reporter1 - Password:
reporter123
- Username:
user1 - Password:
user123
- Layout: 2 cột (Content + Sidebar)
- Responsive: Tự động điều chỉnh
- Theme: Modern với CSS Variables
- Responsive: Tối ưu cho mobile
- Touch-friendly: Dễ sử dụng trên thiết bị cảm ứng
- Java 17 - Ngôn ngữ lập trình
- Jakarta Servlet 6.1.0 - Web framework
- Jakarta JSP - View technology
- Jakarta JSTL - JSP Standard Tag Library
- JDBC - Database connectivity
- Jakarta Mail 2.0.1 - Email functionality
- HTML5 - Markup language
- CSS3 - Styling với Variables
- JavaScript - Client-side logic
- Font Awesome - Icons
- Google Fonts - Typography
- SQL Server - Database management
- JDBC Driver - Database connectivity
- Maven - Dependency management
- Maven Compiler Plugin - Java compilation
- Maven War Plugin - Web application packaging
- Login/Logout với session management
- Role-based access control (Admin/Reporter/User)
- Password change cho Reporter
- Session timeout handling
- CRUD operations cho tin tức
- Image upload và quản lý
- Category management với phân loại
- Approval workflow (Admin duyệt tin)
- View count tracking và thống kê
- Search & filter functionality
- Newsletter subscription tự động
- Email validation với regex
- Bulk email sending với BCC
- Auto-disable invalid emails
- HTML email templates với styling
- Recent news tracking theo session
- Dynamic sidebar với dữ liệu real-time
- Breadcrumb navigation cho UX tốt
- Responsive design cho mọi thiết bị
- Loading states và error handling
- MVC Pattern - Tách biệt logic
- DAO Pattern - Data access abstraction
- Service Layer - Business logic
- Exception Handling - Robust error management
- Unit Testing - Test individual components
- Integration Testing - Test database connections
- Manual Testing - User interface testing
- WAR packaging - Standard web application
- Tomcat deployment - Production ready
- Database migration - Version control cho DB
- Fork repository
- Create feature branch
- Commit changes với clear messages
- Push to branch
- Create Pull Request
- Clean code principles
- Documentation cho complex logic
- Error handling comprehensive
- Security best practices
MIT License - Xem file LICENSE để biết thêm chi tiết.
- Tạo issue với description chi tiết
- Include steps to reproduce
- Attach screenshots nếu cần
- Mô tả tính năng mong muốn
- Explain use case
- Provide mockups nếu có
- Email: [email protected]
- GitHub: https://github.com/ndyudev
Code Lens News là một hệ thống quản lý tin tức hoàn chỉnh với đầy đủ tính năng hiện đại. Với kiến trúc MVC rõ ràng, giao diện responsive và hệ thống email tự động, project này phù hợp cho việc học tập và phát triển thực tế.
Happy Coding! 🚀