web实现统计网页点击量
下面是我写的网页HTML文件
源代码Hello world:
package runoob;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class helloworld {
public String message = "Hello World";
public void init() throws ServletException
{ }
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
{
// 设置响应内容类型
response.setContentType("text/html");
// 实际的逻辑是在这里
PrintWriter out = response.getWriter();
out.println("<h1>" + message + "</h1>");
}
public void destroy()
{
// 什么也不做
}
}
个人简历:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>个人简历</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div id="container" align="center">
<div id="heading">
<h1 align="center" font-size="20px">
<tr>
<td>
<img src="timg.jpg" width="102.4" height="86.5" align="center" alt="中南大学">
</td>
<td>
知行合一 经世致用
</td>
<td>
<a href="test2.jsp">英文版</a>
</td>
<td>
<img onmousemove="src='img03.jpg'" onmouseout="src='img02.jpg'" border="0"
src="img02.jpg" width="158" height="106" alt="图片" align="right" id="img01" >
<button onclick="maxFun(this)">放大</button>
<button onclick="minFun(this)">缩小</button>
</td>
<script>
var imgH;//图片的高度
var imgW;//图片的宽度
var img = document.getElementById("img01");//图片元素
imgH = img.height; //获取图片的高度
imgW = img.width; //获取图片的宽度