今天,一个大学同学,研究生毕业来北京了,入职人人网,月薪12k,倍感压力山大,好好考虑下自己的未来,该怎么走。想考研了,毕业三年了,感觉一直在混日子。今天在外边玩了一天,昨天晚上发完博客把servlet修改了下,前端加了一个后台提交的功能,统计访问量加获取访问IP地址,理论上可以间接判断对方是否读了你发的消息,前提是对方得打开网站,而且你必须要有个域名。把代码贴出来吧,其实也没什么技术含量PS李有才快把我逼疯了:
servlet代码:
package cn.oncelife.fordream; import java.io.IOException; import cn.oncelife.fordream.ForDreamServlet; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class fordream */ @WebServlet("/fordream") public class ForDreamServlet extends HttpServlet { private static final long serialVersionUID = 1L; int sum=0; /** * @see HttpServlet#HttpServlet() */ public ForDreamServlet() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub String s=request.getParameter("count"); String currUrl= request.getRemoteAddr(); int count=Integer.parseInt(s); sum+=count; System.out.println(sum); System.out.println(currUrl); request.getRequestDispatcher("./fordream.jsp").forward(request,response); //response.sendRedirect("。/fordream.jsp"); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub } }
<!-- 字体特效 By:Lonely·Liu domain:2ly.cc --> <%@ 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>I Love You</title> <link rel="shortcut icon" type="image/x-icon" href="/images/favicon.ico" /> <script type="text/javascript" src="http://demo.jb51.net/jslib/jquery/jquery1.3.2.js"></script> <script type="text/javascript"> var str = new Array( '李', '有', '才', '我', '真', '的', '好', '喜', '欢', '你', '你', '知', '道', '吗', '?' ); function autosize(){ $.get("./test?count="+1,function(data,status){ //alert(data); }) //window.location.href="./test?count="+1; var zi = $("#zi"); //字的父节点 就是他爹你知道么 var name = 'handel'; //设置字的class var speed =999 ; //速度 var fontSize = 36; //原始字体大小 var fontMaxSize = 999; //最大字体大小 for(var i=0;i<str.length;i++){ zi.append('<span class="'+name+'" style="font-size:'+fontSize+'px;">'+str[i]+'</span>'); } var i = 0; var t = setInterval(function(){ if(i%str.length == 0) { i = 0; } var dom = zi.find('.'+name).eq(i); dom.animate({ 'fontSize' : fontMaxSize+'px' },speed/2); setTimeout(function(){ dom.animate({ 'fontSize' : fontSize + 'px' },speed/2); },speed/2); i++; },speed); } </script> </head> <body onload=autosize()> <div align="center" font-size=10> <div id="zi"> </div> <!-- <input type="button" value="点我啊!" onclick="autosize()"/> --> </div> </body> </html>
web.xml
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1"> <display-name>iloveyou</display-name> <welcome-file-list> <welcome-file>iloveyou.jsp</welcome-file> </welcome-file-list> <servlet> <servlet-name>fordream</servlet-name> <servlet-class>cn.oncelife.fordream.ForDreamServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>fordream</servlet-name> <url-pattern>/test</url-pattern> </servlet-mapping> </web-app>