1.在src里建servlet包

西蒙购物(中)

西蒙购物(中)

 

下面我们进行测试。

西蒙购物(中)

西蒙购物(中)

2、注销处理类LogoutServlet

 

西蒙购物(中)

测试。

启动服务器,先登录成功,然后测试注销功能。

西蒙购物(中)

以普通用户身份登录成功。

然后测试用户注销功能

西蒙购物(中)

西蒙购物(中)

此时,去服务器端控制台查看信息

西蒙购物(中)

 

3、注册处理类RegisterServlet

西蒙购物(中)

西蒙购物(中)

西蒙购物(中)

下面测试。

启动服务器,访问http://localhost:8080/simonshop/register:

西蒙购物(中)

西蒙购物(中)

此时,我们去NaviCat查看我们的用户表,看是否插入了新的纪录

西蒙购物(中)

telephone字段设置的是11位。重启服务器测试超过11位的telephone。

西蒙购物(中)

西蒙购物(中)

失败了,再次跳转到注册页面。

西蒙购物(中)

com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'telephone' at row 1出现了我们没有捕获的异常,这个问题出在模型层,大家去修改UserDaoImpl里的insert方法。

西蒙购物(中)

4.显示类别处理类showcategoryservlet

 

西蒙购物(中)

 

西蒙购物(中)

进行测试。

重启服务器

西蒙购物(中)

在控制台查看信息

西蒙购物(中)

5、显示商品处理类(ShowProductServlet)西蒙购物(中)

下面测试。

重启服务器,访问http://localhost:8080/simonshop/showProduct?categoryid=1

西蒙购物(中)

 

西蒙购物(中)

相关文章: