Develop a web application that should have following features.

  1. User can register and then login to the application.
  2. The users information should be maintained in database.
  3. Use standard logging framework log4j.
  4. The application should support session management, no JSPs should be visible without session. Users can logout anytime from the application.
  5. We should not show application and server details to user incase of any exception in application or other common errors like 404.

    Once we have our basic application ready, we can move on to add other features.

    Design Decisions

    1. Since login page is the entry point of application, we will have a simple login.html where user can enter their credentials; email and password. We can’t rely on javascript validations, so we will do server side validation and incase of missing information we will redirect user to login page with error details.
    2. We will have a register.html from where user can register to our application, we will provide it’s link in the login page for new user. User should provide email, password, name and country details for registration.

      If any information is missing, user will remain on same page with error message. If registration is successful, user will be forwarded to the login page with registration success information and they can use email and password to login.

    3. We will use MySql database for persisting user information. We will create a new database, user and Users table for our application. Since our application totally depends on Database Connection, we will create a servlet context listener to initialize the database connection and set it as context attribute for other servlets.

      We will keep DB configuration details configurable through deployment descriptor. We will also add MySql Java Connector jar to the application libraries.

    4. Since we want to use log4j and configure it properly before usage, we will utilize servlet context listener to configure log4j and keep the log4j configuration XML file location in web.xml init parameters. We will write our application logs in a separate log file dbexample.log for easier debugging.
    5. Incase of any exceptions like “Database Connection Error” or 404 errors, we want to present a useful page to user. We will utilize servlet exception handling and write our own Exception Handler servlet and configure it in deployment descriptor.
    6. Once the user logins successfully, we will create a session for the user and forward them to home.jsp where we will show basic information of the user. We will have a model class User that will store the user data into session. User home page also provide logout button that will invalidate the session and forward them to login page.
    7. We need to make sure all the JSPs and other resources are accessible only when user has a valid session, rather than keeping session validation login in all the resources, we will create a Servlet Filter for session validation and configure it in deployment descriptor.
    8. We will use Servlet 3.0 features for servlet configuration, listeners and filters rather than keeping all of these in deployment descriptor. We will use Eclipse for development and Tomcat 7 for deployment.

最新文章

  1. 微信公众号入门学习2_使用C#,ASP.NET APIController如何被动回复用户消息
  2. java笔记1
  3. (转)四种常见的 POST 提交数据方式
  4. Linux登录出现modle is unknow
  5. iOS 用命令实现简单的打包过程
  6. opencv求取RGB分量
  7. 【Spark学习】使用Maven创建Spark
  8. WdatePicker时间控件联动选择
  9. Glide制作圆形图片
  10. hdu 1242 Rescue_bfs+优先队列
  11. WPF之Binding的三种简单写法
  12. mysql高可用架构方案之二(keepalived+lvs+读写分离+负载均衡)
  13. R 语言开发环境搭建
  14. CSS的三种手段让元素脱离标准本文档流——浮动、绝对定位、固定定位
  15. (转)Java线程:新特征-线程池
  16. 【Python实战】模块和包导入详解(import)
  17. Intel 82599网卡异常挂死原因
  18. SNF快速开发平台项目实践介绍
  19. 快速部署Apache服务静态网站
  20. 001.Docker简介概述

热门文章

  1. 2018-2019-2 《网络对抗技术》Exp0 Kali安装 Week1 20165211
  2. centos7 update docker
  3. ODAC(V9.5.15) 学习笔记(七)TOraUpdateSQL
  4. 5. 多重背包问题 II 【用二进制优化】
  5. javascript的执行过程, 语法错误和运行时错误?
  6. 洛谷luogu2782
  7. asp.net tag
  8. hihoCoder week19 RMQ问题再临-线段树 单点更新 区间查询
  9. LuoguP2680 运输计划
  10. (zhuan) Notes on Representation Learning