Code Monkey home page Code Monkey logo

web-dev-quickstart's Introduction

Java Web开发起步练习项目

涉及到的知识点:

  • Servlet的层级,实现方式
  • request取请求参数
  • 请求乱码的处理
  • 服务器端跳转、传参
  • response的使用
  • 响应乱码的处理
  • 客户端跳转、传参
  • session的概念和用法
  • cookie的概念和用法
  • 采用合理的布局和样式、图标等优化页面

1.登录起步练习

  • login.html输入用户名和密码 Snipaste_2019-09-21_15-29-21.png
  • LoginServlet拦截/login.do请求,取得参数,判定是否和指定值相等,相等就将用户名存入session,然后重定向到index.jsp主页
  • 主页通过jsp表达式<%= %>,用session内置对象取出用户名显示 Snipaste_2019-09-21_15-29-33.png

2.服务端转发数据至目标页面渲染

  • Student实体类,封装基础属性
  • StudentServlet,拦截/students请求,创建一个集合存入若干Student对象,存入request,并通过服务器转发(地址栏不变)将request带到student.jsp页面
  • student.jsp页面用request内置对象取出数据,并借助页面内置对象和EL表达式,遍历数据集合,在页面上显示 学生信息显示.jpg

3.登录案例进阶

  • 未登录用户可以在首页浏览所有后台返回的图书信息 未登录用户

  • 点击"去登录"可以跳转到登录页,输入账号和密码,进后台匹配 登录页面

  • 登录成功跳回首页,顶部显示用户头像 登录成功

  • 点击用户头像可以进入用户个人信息页面,少量信息为后台动态数据,其余是为了填充页面写的静态页面 个人中心

web-dev-quickstart's People

Contributors

mqxu avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.