1、信息网络应用基础信息网络应用基础第2次实验:动态页面制作专业 姓名 班级学号 班内序号作业提交说明:1、严格按实验要求制作动态页面,并在“实现功能介绍”标题下,按实验要求描述完成情况,尽可能体现个性;2、雷同代码 or 网上代码 没有实验成绩;3、在“源代码及显示效果”标题下,按不同文件名粘贴源代码及显示效果(浏览器效果截图),页面和显示效果对应,如范例所示(贴页面内容时请删去范例);4、仅提交本文档;5、文件命名格式严格按照模板提供的方式补齐,邮件标题和文件名一致。1实验要求:1.主题:设计网上商店或个人网站的主页(任选一);2.使用基本JSP元素和内置对象设计动态页面;3.主页面命名使用m
2、ypage.jsp/html,以便检查;4.使用request、response对象完成登录处理功能:能提取表单信息、登录有误能实现重定向,选作:页面刷新功能;5.使用session对象完成在多个页面中的数据转发功能;6.尽量完成使用Cookie实现访客计数或显示上次浏览时间的功能,选作:使用application对象实现网站计数功能;7.选作:使用include指令标识/动作元素、使用动作元素8.如果遇到问题记录到文档中(包括解决方法)。2实现功能介绍2.1功能描述1.使用了request、response对象完成登录处理功能:能提取表单信息、登录有误能实现重定向。Request对象的get
3、Parameter()以及getParameterValue()方法,可以用来获取用户提交的数据。使用了sendRedirect()实现登录错误时重定向。2.使用了response对象的setHeader()方法设置HTTP头中的值,程序用到了日期的方法,用page指令导入java.util.*类,实现了页面刷新功能,并显示当前时间。3.使用了session对象完成了在多个页面中的数据转发功能,这里session内置对象使用setAttribute()和getAttribute()方法创建及获取客户的用户名信息。实现了用户名在多个页面转发功能。4. 使用Cookie实现了访客计数。2.2操作流
4、程如有多个页面,请简要描述它们的关系。Mypage.jsp主页面,若只输入密码,则登录页面重置,还是返回到主页面。主页面显示第几次访问该网站。输入用户名和密码登录,跳转到veri.jsp欢迎页面。点击products进入产品介绍页面在products页面里可以选择想买的商品,点击提交会跳转到购物车页面。点击abouts可以跳转到花语大全页面哦。Abouts.jsp页面可以显示当前时间。3源代码及显示效果my little shop* padding: 0px; margin: 0px;div#header width:100%#k width: 80%; height: 200px; back
5、ground-image:url(images/header.jpg); background-repeat: no-repeat; margin-left: auto; margin-right: auto;div#templatemo_main width:100%; height:900px; text-align:center; /*margin-top:210px;*/ background-color: pink; position: relative;div#templatemo_menu width:100%; text-align:center;padding-top:0px
6、;background-image: url(images/templatemo_menu.png); background-size: 100% 70px;#menuul list-style-type: none; width: 100%;#menuulli display: inline-block; width: 20%; height: 40px; line-height: 40px;div#login /*margin-top: auto;*/ width: 230px; height:190px; padding-top: 0px; /*float: left;*/ /*绝对定位
7、浮在父元素之上,用left right top bottom定位*/ position: absolute; right: 80px; top:90px;/*定位到h1那行字*/#templatemo_mainh1 /*vertical-align:sub;*/ margin-top: 50px; margin-bottom: 30px; width:100%; font-size:50px; font-style: italic; Home Products About Carts !- - 用户名: 密 码: /*登录成功后跳转到Verification.jsp*/
8、浪漫花语 红玫瑰: 爱情 热恋 白玫瑰: 天真 纯洁 蓝玫瑰: 妖娆 神秘 红蔷薇: 高贵 美丽 蓝蔷薇: 梦幻 温柔 百合: 清新 脱俗 郁金香: 表白&n
9、bsp; 祝福 康乃馨: 母爱 真情 石竹花: 才能 大胆 welcome to my shop! %response.setContentType(text/html;charset=UTF-8);/PrintWriter out = response.getWriter();Cookie cookies = request.getCookies(); /*使用cookie完成了访客计数*/if (cookies!=null
10、) out.write(您上次访问的时间是:); for (int i = 0; i 你的倩影 就好似一道美丽晨曦 一生有你 可知一生有你我都陪在你身边 灿烂笑容 谢谢你灿烂的笑容 不变的承诺 你像那沾满露珠的花瓣 爱的最高点 如果你是美丽海岸 恋恋花语 你是我最特别的存在 朝朝暮暮 我把誓言一生一世戴在你手指 一生的期盼 喜欢你是淡淡的爱 天使的祝福 愿你每天都快乐幸福 Verification.jsp my little shop* padding: 0px; margin: 0px;div#header width:100%#k width: 80%; height: 200px; ba
11、ckground-image:url(images/header.jpg); background-repeat: no-repeat; margin-left: auto; margin-right: auto;div#templatemo_main width:100%; height:900px; text-align:center; /*margin-top:210px;*/ background-color: pink; position: relative;div#templatemo_menu width:100%; text-align:center;padding-top:0
12、px;background-image: url(images/templatemo_menu.png); background-size: 100% 70px;#menuul list-style-type: none; width: 100%;#menuulli display: inline-block; width: 20%; height: 40px; line-height: 40px;div#login /*margin-top: auto;*/ width: 230px; height:190px; padding-top: 0px; /*float: left;*/ /*绝对定位浮在父元素之上,用left right top bottom定位*/ position: absolute; right: 80px; top:90px;/*定位到h1那行字*/#templatemo_mainh1 /*vertical-align:sub;*/ margin-top: 40px; margin-bottom: 20px; width:100%; font-size:50px; font-style: italic; Home Products About Carts !- - 您好,亲爱的,欢迎来到我的小店!
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1