废话不多说,先贴代码
先是注册页面:zhuce.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> "UTF-8">Insert title here
然后是登录界面:login.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> "UTF-8">Insert title here
主界面就有些简陋了,因为主要是实现注册登录的:welcome.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> "UTF-8">Insert title here "center"> 欢迎您!
servlet实现登录的主要方法
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub request.setCharacterEncoding("utf-8"); response.setContentType("text/html;charset=utf-8"); String username = request.getParameter("username"); String password = request.getParameter("password"); String psw =new UserDao().findUsername(username); if(psw ==null){ PrintWriter out = response.getWriter(); out.println(" "); out.println("