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.

Servlet JDBC Example的更多相关文章

  1. MVC-1(javabean+jsp+servlet+jdbc)

    这是一篇最初版本的mvc设计模式的demo.路要一步一步走,弄明白这其中的逻辑,对后面掌握ssh,ssm等框架大有裨益. 计算机系的同学们也要为毕设做准备了,希望可以帮你们迈出自己做毕设的第一步(微笑 ...

  2. Jsp+Servlet+JDBC的使用复习

    最近对JDBC进行了复习,对事物的理解,连接池的使用等部分都有一个复习,所以使用Servlet+JDBC完成了一个小Demo,在这里对这种底层的操作进行总结.框架的使用的确方便了我们的开发,但是底层的 ...

  3. 使用JSP+Servlet+Jdbc+Echatrs实现对豆瓣电影Top250的展示

    使用JSP+Servlet+Jdbc+Echatrs实现对豆瓣电影Top250的展示 写在前面: 有的小伙伴,会吐槽啦,你这个标题有点长的啊.哈哈 ,好像是的!不过,这个也是本次案例中使用到的关键技术 ...

  4. [项目分享]JSP+Servlet+JDBC实现的云端汽修后台管理系统

    本文存在视频版本,请知悉 项目简介 项目来源于:https://gitee.com/chenlinSir/CloudDemo-servlet 难度等级:简单 基于JSP+Servlet+Jdbc的云端 ...

  5. [项目分享]JSP+Servlet+JDBC实现的学生信息管理系统

    本文存在视频版本,请知悉 项目简介 项目来源于:https://gitee.com/liu_xu111/JavaWeb01 这次分享一个学生管理系统,我感觉这是程序员在大学时期的毕设和课程设计选择最多 ...

  6. Maven+JSP+Servlet+JDBC+Mysql实现的dbExper宾馆管理系统

    本文存在视频版本,请知悉 项目简介 项目来源于:https://github.com/mafulong/databaseExper-hotelMaster 这次分享的也是毕设或课程设计选择一样很多的宾 ...

  7. JSP+Servlet+JDBC+Mysql实现的天才会议管理系统

    本文存在视频版本,请知悉 项目简介 项目来源于:https://github.com/hegexunmeng/meeting-system 这次分享一个会议管理系统,前端后端几乎没有使用任何框架,适合 ...

  8. Maven+JSP+Servlet+JDBC+Redis+Mysql实现的黑马旅游网

    项目简介 项目来源于:https://gitee.com/haoshunyu/travel 本系统是基于Maven+JSP+Servlet+JdbcTemplate+Redis+Mysql实现的旅游网 ...

  9. JSP+Servlet+JDBC+C3P0实现的人力资源管理系统

    项目简介 项目来源于:https://github.com/ruou/hr 本系统基于JSP+Servlet+C3P0+Mysql.涉及技术少,易于理解,适合JavaWeb初学者学习使用. 难度等级: ...

  10. JSP+Servlet+JDBC+mysql实现的个人日记本系统

    项目简介 项目来源于:https://gitee.com/wishwzp/Diary 本系统基于JSP+Servlet+Mysql 一个基于JSP+Servlet+Jdbc的个人日记本系统.涉及技术少 ...

随机推荐

  1. 对客户端攻击:adobe_toolbutton

    对客户端攻击:adobe_toolbutton 漏洞简介 远程攻击者可以利用漏洞执行任意指令.当用户打开特定pdf就可以触发payload. 实践过程 输入命令use exploit/windows/ ...

  2. JavaScript中this的用法 及 如何改变this的指向

    要懂得JavaScript中this的用法,首先需要知道,JavaScript中的作用域相关知识. var fun = function(){ var flag = 1; console.log(fl ...

  3. topcoder srm 700 div1 -3

    1.有$n$个人,编号1到$n$.将其平均分到$m$个房间中,每个房间$K$个人.现在知道每个房间编号最小的人的编号.对于给出的人$x$.问其可能在的房间有多少种? 思路:先假设其在某个房间,然后判断 ...

  4. topcoder srm 705 div1 -3

    1.设有一个字母表$T$,对于一个单词$w$,若对于任意的$0\leq i< |w|-1$,满足$w_{i}$在$T$中的排名小于等于$w_{i+1}$在$T$中的排名,则称$s$在$T$中是合 ...

  5. Vim 插键及配置

    如果你觉得这个页面广告太多,欢迎移步博客阅读:Vim 插键及配置 编辑器之神 -- Vim 平日使用vim经常编辑文件,想想使用时的痛点,决定研究一下插件的使用. Vim的扩展通常也被成为bundle ...

  6. CentOS Yum 源搭建

    创建yum源服务,主要用到了两个软件createrepo和httpd.前者是创建yum源索引的工具,后者是提供文件在线流浪的功能,当然,除了httpd之外,你也可以使用nginx替代. creater ...

  7. Android四种布局方式

    线性布局 <LinearLayout android:layout_width="match_parent" android:layout_height="wrap ...

  8. 【译】第37节---EF6-异步查询和保存

    原文:http://www.entityframeworktutorial.net/entityframework6/async-query-and-save.aspx 你可以在.NET4.5下使用 ...

  9. CSS深入

    块元素:div.h1.p等等. 列表的样式: /*使用系统提供的一些样式:例如无序.有序都可以使用circle*/ ul{ list-style-type: circle; } ol{ list-st ...

  10. JqGrid 列时间格式化

    {name:'createTime',index:'createTime',label:"创建时间", editable:false,formatter:"date&qu ...