各位看官,终于等到今天,自己动手写一个小小的web应用,简单到不能再简单,聊以记录个人学习点滴,路过看过,请不吝赐教!
实现的功能点:
1.登录用户名、密码和验证码验证;
2.第二次登录自动记住用户名;
3.欢迎页面提示上次登录时间;
4.消费信息查询页面分页;
5.新增、删除、修改消费记录;
6.防止盗连(非登录页面直接登录校验提示);
本web应用的页面是纯servlet的,用到的Java web技术:
1.Jdbc;
2.Servlet;
3.一点点cookie;
4.一点点session;
其他知识点:
1.一点点Javascript ;
2.简单的手写MVC三层开发模式;
源码下载链接:http://download.csdn.net/detail/sparrow00004/8351455
直接贴上几张截图(不要吐槽排版呃。。。):
1.登录界面
2.欢迎界面
3.消费记录查询页面
4.新增消费记录
5.修改消费记录
数据库建表脚本和初始化枚举值:
-- Create table
create table UM_USERS
(
user_id NUMBER,
user_name VARCHAR2(32) not null,
login_name VARCHAR2(32) not null,
password VARCHAR2(32) not null,
email VARCHAR2(32),
telephone NUMBER(11)
)
tablespace USERS
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64
minextents 1
maxextents unlimited
);
-- Create table
create table UM_PAYMENT
(
payment_id NUMBER,
user_id NUMBER,
payment_type NUMBER,
pay_date DATE,
pay_amount NUMBER,
is_print_invoice NUMBER,
remark VARCHAR2(255)
)
tablespace USERS
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64
minextents 1
maxextents unlimited
);
-- Add comments to the columns
comment on column UM_PAYMENT.payment_type
is '1 现金; 2 POS刷卡; 3 支付宝; 4 其他;';
comment on column UM_PAYMENT.is_print_invoice
is '1 已开发票; 2 未开发票;';
-- Create table
create table CFG_ENUM
(
owner VARCHAR2(8),
table_name VARCHAR2(32),
coloumn_name VARCHAR2(32),
enum_code VARCHAR2(32),
enum_value NUMBER,
create_date DATE,
expire_date DATE,
remark VARCHAR2(64),
enum_desc VARCHAR2(64)
)
tablespace USERS
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64
minextents 1
maxextents unlimited
);
insert into um.cfg_enum (OWNER, TABLE_NAME, COLOUMN_NAME, ENUM_CODE, ENUM_VALUE, CREATE_DATE, EXPIRE_DATE, REMARK, ENUM_DESC)
values ('UM', 'UM_PAYMENT', 'PAYMENT_TYPE', 'CASH', 1, to_date('13-12-2014', 'dd-mm-yyyy'), to_date('31-12-2099', 'dd-mm-yyyy'), null, '现金');
insert into um.cfg_enum (OWNER, TABLE_NAME, COLOUMN_NAME, ENUM_CODE, ENUM_VALUE, CREATE_DATE, EXPIRE_DATE, REMARK, ENUM_DESC)
values ('UM', 'UM_PAYMENT', 'PAYMENT_TYPE', 'POS', 2, to_date('13-12-2014', 'dd-mm-yyyy'), to_date('31-12-2099', 'dd-mm-yyyy'), null, 'POS刷卡');
insert into um.cfg_enum (OWNER, TABLE_NAME, COLOUMN_NAME, ENUM_CODE, ENUM_VALUE, CREATE_DATE, EXPIRE_DATE, REMARK, ENUM_DESC)
values ('UM', 'UM_PAYMENT', 'PAYMENT_TYPE', 'ALIPAY', 3, to_date('13-12-2014', 'dd-mm-yyyy'), to_date('31-12-2099', 'dd-mm-yyyy'), null, '支付宝');
insert into um.cfg_enum (OWNER, TABLE_NAME, COLOUMN_NAME, ENUM_CODE, ENUM_VALUE, CREATE_DATE, EXPIRE_DATE, REMARK, ENUM_DESC)
values ('UM', 'UM_PAYMENT', 'PAYMENT_TYPE', 'OTHER', 4, to_date('13-12-2014', 'dd-mm-yyyy'), to_date('31-12-2099', 'dd-mm-yyyy'), null, '其他');
insert into um.cfg_enum (OWNER, TABLE_NAME, COLOUMN_NAME, ENUM_CODE, ENUM_VALUE, CREATE_DATE, EXPIRE_DATE, REMARK, ENUM_DESC)
values ('UM', 'UM_PAYMENT', 'IS_PRINT_INVOICE', 'YES', 1, to_date('13-12-2014', 'dd-mm-yyyy'), to_date('31-12-2099', 'dd-mm-yyyy'), null, '已打');
insert into um.cfg_enum (OWNER, TABLE_NAME, COLOUMN_NAME, ENUM_CODE, ENUM_VALUE, CREATE_DATE, EXPIRE_DATE, REMARK, ENUM_DESC)
values ('UM', 'UM_PAYMENT', 'IS_PRINT_INVOICE', 'NO', 0, to_date('13-12-2014', 'dd-mm-yyyy'), to_date('31-12-2099', 'dd-mm-yyyy'), null, '未打');
下载源码链接:http://download.csdn.net/detail/sparrow00004/8351455