JSP实现用户登录、注册和退出功能实现用户登录、注册和退出功能
主要为大家详细介绍了JSP实现用户登录、注册和退出功能,具有实用性和参考价值,感兴趣的小伙伴们可以参考一下
本文讲述使用JSP实现用户登录,包括用户登录、注册和退出功能等。
1.系统用例图系统用例图
2.页面流程图页面流程图
3.数据库设计数据库设计
本例使用oracle数据库
创建用户表
包括id,username,password和email,共4个字段
-- Create table
create table P_USER
(
id VARCHAR2(50) not null,
username VARCHAR2(20),
password VARCHAR2(20),
email VARCHAR2(50)
)
tablespace USERS
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64
minextents 1
maxextents unlimited
);
-- Add comments to the table
comment on table P_USER
is '用户表';
-- Add comments to the columns
comment on column P_USER.id
is 'id';
comment on column P_USER.username
is '用户名';
comment on column P_USER.password
is '密码';
comment on column P_USER.email
is 'email';
4.页面设计页面设计
4.1登录页面登录页面
login.jsp
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>登录页面</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<form action="login_action.jsp" method="post">
<table>
<tr>
<td colspan="2">登录窗口</td>
</tr>
<tr>
<td>用户名:</td>
<td><input type="text" name="username" />
</td>
评论0