前两篇主要是开发了注册功能,接下来我们进行登录功能的开发:
一、对 index.jsp
界面做修改,设计的内容后面会有讲到
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
首页
欢迎您:${user.nickname } 注销
注册
登录
二、显示登录界面的 LoginUIServlet
package cn.itcast.web.UI;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
//提供登陆界面
public class LoginUIServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.getRequestDispatcher("/WEB-INF/jsp/login.jsp").forward(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request, response);
}
}
三、登录界面 login.jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
登录界面