信息网络应用基础文档格式.docx
- 文档编号:16869537
- 上传时间:2022-11-26
- 格式:DOCX
- 页数:41
- 大小:4.94MB
信息网络应用基础文档格式.docx
《信息网络应用基础文档格式.docx》由会员分享,可在线阅读,更多相关《信息网络应用基础文档格式.docx(41页珍藏版)》请在冰豆网上搜索。
4.使用Cookie实现了访客计数。
2.2操作流程
如有多个页面,请简要描述它们的关系。
Mypage.jsp主页面,若只输入密码,则登录页面重置,还是返回到主页面。
主页面显示第几次访问该网站。
输入用户名和密码登录,跳转到veri.jsp欢迎页面。
点击products进入产品介绍页面
在products页面里可以选择想买的商品,点击提交会跳转到购物车页面。
点击abouts可以跳转到花语大全页面哦。
Abouts.jsp页面可以显示当前时间。
3源代码及显示效果
<
%@pagelanguage="
java"
contentType="
text/html;
charset=GB18030"
pageEncoding="
GB18030"
%>
%@pageimport="
java.util.*"
%>
!
DOCTYPEhtmlPUBLIC"
-//W3C//DTDXHTML1.0Transitional//EN"
"
http:
//www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
>
htmlxmlns="
//www.w3.org/1999/xhtml"
head>
metahttp-equiv="
Content-Type"
content="
charset=utf-8"
/>
title>
mylittleshop<
/title>
styletype="
text/css"
*{
padding:
0px;
margin:
}
div#header{
width:
"
100%"
#k{
80%;
height:
200px;
background-image:
url(images/header.jpg);
background-repeat:
no-repeat;
margin-left:
auto;
margin-right:
div#templatemo_main{
100%;
900px;
text-align:
center;
/*margin-top:
210px;
*/
background-color:
pink;
position:
relative;
div#templatemo_menu{
padding-top:
0px;
background-image:
url(images/templatemo_menu.png);
background-size:
100%70px;
#menuul{
list-style-type:
none;
100%;
#menuul>
li{
display:
inline-block;
20%;
40px;
line-height:
div#login{
auto"
;
230px"
190px"
padding-top:
0px"
/*float:
left;
/*绝对定位浮在父元素之上,用leftrighttopbottom定位*/
absolute;
right:
80px;
top:
90px;
/*定位到h1那行字*/
#templatemo_main>
h1{
/*vertical-align:
sub;
margin-top:
50px;
margin-bottom:
30px;
font-size:
50px;
font-style:
italic;
/style>
/head>
body>
<
divid="
header"
k"
/div>
templatemo_main"
templatemo_menu"
ulid="
menuul"
li>
ahref="
mypage.jsp"
>
Home<
/a>
/li>
products.jsp"
Products<
about.jsp"
About<
carts.html"
Carts<
/ul>
login"
--<
hrwidth="
80%"
-->
formaction="
Verification.jsp"
method="
post"
tablestyle="
margin:
50%000"
border="
1"
background="
images/login.png"
tr>
td>
用户名:
/td>
inputtype="
text"
name="
user"
/tr>
密&
nbsp;
&
码:
password"
pwd"
tdcolspan="
6"
align="
center"
submit"
value="
登录"
reset"
重置"
/table>
/form>
/*登录成功后跳转到Verification.jsp*/
50px000"
align:
tdbgcolor="
green"
width="
240px"
height="
40px"
浪漫花语
tdbackground="
images/1111.png"
30px"
红玫瑰:
爱情&
热恋
白玫瑰:
天真&
纯洁
蓝玫瑰:
妖娆&
神秘
红蔷薇:
高贵&
美丽
蓝蔷薇:
梦幻&
温柔
百合:
清新&
脱俗
郁金香:
表白&
祝福
康乃馨:
母爱&
真情
石竹花:
才能&
大胆
30px000"
imgsrc="
images/logo.png"
60px"
h1align="
welcometomyshop!
br/>
/h1>
%
response.setContentType("
charset=UTF-8"
);
//PrintWriterout=response.getWriter();
Cookie[]cookies=request.getCookies();
/*使用cookie完成了访客计数*/
if(cookies!
=null){
out.write("
您上次访问的时间是:
for(inti=0;
i<
cookies.length;
i++){
Cookiecookie=cookies[i];
if(cookie.getName().equals("
lastAccessTime"
)){
LonglastAccessTime=Long.parseLong(cookie.getValue());
Datedate=newDate(lastAccessTime);
out.write(date.toLocaleString());
}
}else{
这是您第一次访问本站!
Cookiecookie=newCookie("
System.currentTimeMillis()+"
response.addCookie(cookie);
tablewidth="
72%"
style="
0002%"
cenetr"
border:
2"
border-width:
2px5px5px2px"
tdalign="
valign="
middle"
images/a.jpg"
300px"
200px"
images/b.jpg"
images/c.jpg"
images/table.png"
你的倩影就好似一道美丽晨曦
一生有你可知一生有你我都陪在你身边
灿烂笑容谢谢你灿烂的笑容
images/d.jpg"
images/e.jpg"
images/f.jpg"
不变的承诺你像那沾满露珠的花瓣
爱的最高点如果你是美丽海岸
恋恋花语你是我最特别的存在
images/g.jpg"
images/h.jpg"
images/i.jpg"
朝朝暮暮我把誓言一生一世戴在你手指
一生的期盼喜欢你是淡淡的爱
天使的祝福愿你每天都快乐幸福
/body>
/html>
Verification.jsp
20px;
%Stringstr=null;
str=request.getParameter("
/*使用request获取用户名*/
session.setAttribute("
str);
/*使用session完成用户名在页面之间的转发*/
if(str==null)
{str="
byteb[]=str.getBytes("
ISO-8859-1"
str=newString(b);
if(str.equals("
))
{response.sendRedirect("
/*使用sendRedirect完成页面重定向功能*/
else{out.print(str+"
"
b>
fontsize="
4"
您好,<
亲爱的<
%Stringusername=request.getParameter("
);
%=username%>
,<
欢迎来到我的小店!
/font>
/b>
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 信息网络 应用 基础
![提示](https://static.bdocx.com/images/bang_tan.gif)