第二次网信实验

第二次网信实验
先写个页面跳转
在这里插入图片描述

然后跳到主界面

<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<html>
<head>
	 <title> mypage </title>
</head>
<body>

	<%@ include file="index.jsp"%>
	<h1>Welcome to Paris Saint-Germain F.C.!</h1>

	<h3>Here are three forward members</h3>
	<p>Click on pictures to learn more!</p>
	<!--注释是这样写的 -->
	<!-- 前面是一些基础文字设置-->
	<a  target="_blank" href="https://baike.baidu.com/item/%E5%86%85%E9%A9%AC%E5%B0%94%C2%B7%E8%BE%BE%E5%B8%AD%E5%B0%94%E7%93%A6/4460782?fromtitle=%E5%86%85%E9%A9%AC%E5%B0%94&fromid=3431139&fr=aladdin/">
	<img src="jp/Neymar.jpg" alt="Neymar" width="237" height="332"/>
	</a>

	<a  target="_blank" href="https://baike.baidu.com/item/%E5%9F%BA%E5%88%A9%E5%AE%89%C2%B7%E5%A7%86%E5%B7%B4%E4%BD%A9/19408535?fromtitle=%E5%A7%86%E5%B7%B4%E4%BD%A9&fromid=19416599&fr=aladdin/">
	<img src="jp/mbappe.jpg" alt="Mbappe" width="237" height="332"/></a>

	<a  target="_blank" href="https://baike.baidu.com/item/%E5%AE%89%E8%B5%AB%E5%B0%94%C2%B7%E8%BF%AA%E9%A9%AC%E5%88%A9%E4%BA%9A/2551279?fromtitle=%E8%BF%AA%E9%A9%AC%E5%88%A9%E4%BA%9A&fromid=5426107&fr=aladdin">
	<img src="jp/dimaria.jpg" alt="DiMaria" width="237" height="332"/></br></a>


	
	<hr>
	<!--三封图片,加下划线,下面弄个发邮件 -->
		<h4>Contact to LPZ, the Website Maker</h4>
	<a target="_blank" href="mailto:2018211094@bupt.edu.cn" alt="email address">send E-mail</a>
	<hr>
	<!--下面表单-->
	<!--一组额外的标签 details 和 summary,把反馈界面单独列出来了-->


			<form name="data" action="testresponse.jsp" method="post">
				Please leave your information~<br><br>
				username:<input type="text" name="user" /> <br/><br/>
				password:<input type="text" name="password" /><br/><br/>
				how's your experience<input type="text" name="experience" /> <br/><br/>
				phone:<input type="text" name="phone" /><br/><br/>
				<input type="submit" value="end" />
			</form>


	now the time is:
		<%
		response.setHeader("refresh","100");
		out.println(new Date().toString());
		
		 %>
	 <hr>
	 <a  href="redmypage.html">Change to red!</a>

<br/>
<%Cookie temp = null;
int count=1;
String currenttime = new Date().toString();
String lasttime = null;
int lastcount=0;
Cookie[] cookies = request.getCookies(); 
if(cookies!=null){
for(int i=0;i<cookies.length;i++){
temp=cookies[i];
if (temp.getName().equals("accessCount")){ 
lastcount = Integer.parseInt(temp.getValue());%> 
the time you came here until now is <%= lastcount %><br/>
 <% count=lastcount+1;
temp.setValue(Integer.toString(count)); 
response.addCookie(temp);
}
if (temp.getName().equals("date")){ /
lasttime=temp.getValue();%>
you last time online is <%= lasttime %>
<% lasttime=currenttime;
temp.setValue(lasttime); 
response.addCookie(temp); 
}
}
}
if (lastcount==0){
lastcount = count+1;
Cookie accessCount = new Cookie("accessCount", String.valueOf(lastcount)); //创建记录浏览次数的cookie
accessCount.setMaxAge(30*24*60*60);%> 
<%= count %><br/>
<% response.addCookie(accessCount);
}
%>
	


</body>
</html>

参考上次的,还加了cookie
输入表单后
在这里插入图片描述

用session最后

在这里插入图片描述

附一个基础版
创建了就是这样的

<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%
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>My JSP 'index.jsp' starting page</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>
    This is my JSP page. <br>
  </body>
</html>

再附一个8080端口被占用的问题解决
https://blog.csdn.net/weixin_44886869/article/details/110390571

因为是校内作业,就不放源代码了,可参考思路。想搜的也都能搜到。

  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。 经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。 经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。 经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值