⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 homepage_jsp.java

📁 仿校内网站
💻 JAVA
字号:
package org.apache.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.sql.*;
import myTools.DataBase;
import java.sql.*;
import myTools.TimeMaker;
import java.util.ArrayList;

public final class homepage_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

  private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();

  private static java.util.List _jspx_dependants;

  private javax.el.ExpressionFactory _el_expressionfactory;
  private org.apache.AnnotationProcessor _jsp_annotationprocessor;

  public Object getDependants() {
    return _jspx_dependants;
  }

  public void _jspInit() {
    _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
    _jsp_annotationprocessor = (org.apache.AnnotationProcessor) getServletConfig().getServletContext().getAttribute(org.apache.AnnotationProcessor.class.getName());
  }

  public void _jspDestroy() {
  }

  public void _jspService(HttpServletRequest request, HttpServletResponse response)
        throws java.io.IOException, ServletException {

    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;


    try {
      response.setContentType("text/html; charset=gb2312");
      pageContext = _jspxFactory.getPageContext(this, request, response,
      			"", true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\n");
      out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n");
      out.write("<html xmlns=\"http://www.w3.org/1999/xhtml\">\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("    ");
            String be_visited_id = (String)session.getAttribute("be_visited_id");            String user_id = (String)session.getAttribute("user_id");            System.out.println(user_id);            if((user_id==null) && (be_visited_id==null)){                be_visited_id = "1000";                session.setAttribute("be_visited_id", be_visited_id);            }else if(user_id != null){                be_visited_id = user_id;                session.setAttribute("be_visited_id", be_visited_id);            }            String flag = request.getParameter("be_visited_id");            if(flag != null){                be_visited_id = flag;                session.setAttribute("be_visited_id", be_visited_id);            }            String idString = be_visited_id;                        DataBase db = new DataBase();            ResultSet rs = null;            db.connectToDB();            String SQL = "select user_name, visitor_count, last_visit, create_time, photo_path from users where user_id = " + idString + ";";            rs = db.executeQuery(SQL);            String user_name = "ZER";            String visit_account = "0";            String last_visit = null;            String create_time = "公元前";            String host_photo_path = "";            if(rs.next()){                user_name = rs.getString(1);                visit_account = rs.getString(2);                last_visit = rs.getString(3);                create_time = rs.getString(4).substring(0, 10);                host_photo_path = rs.getString(5);            }    
      out.write("\n");
      out.write("    <head>\n");
      out.write("        <meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\" />\n");
      out.write("        <title>");
      out.print(user_name);
      out.write("个人空间</title<link href=\"css.css\" rel=\"stylesheet\" type=\"text/css\" media=\"all\" />>\n");
      out.write("        <link href=\"css.css\" rel=\"stylesheet\" type=\"text/css\" media=\"all\" />\n");
      out.write("    </head>\n");
      out.write("    \n");
      out.write("    <body>\n");
      out.write("        <div id=\"container\">\n");
      out.write("            <div id=\"header\">\n");
      out.write("                <div id=\"menu\">\n");
      out.write("                    <ul>\n");
      out.write("                        <li><a href=\"diarys.jsp\" target=\"iframe\">日志</a></li>\n");
      out.write("                        <li class=\"menuDiv\"></li>\n");
      out.write("                        <li><a href=\"albums.jsp\" target=\"iframe\">相册</a></li>\n");
      out.write("                        <li class=\"menuDiv\"></li>\n");
      out.write("                        <li><a href=\"articlelist.jsp\">论坛</a></li>\n");
      out.write("                        <li class=\"menuDiv\"></li>\n");
      out.write("                        <li><a href=\"friends.jsp\" target=\"iframe\">好友</a></li>\n");
      out.write("                        <li class=\"menuDiv\"></li>\n");
      out.write("                        <li><a href=\"messages.jsp\" target=\"iframe\">留言</a></li>\n");
      out.write("                    </ul>\n");
      out.write("                </div>\n");
      out.write("                <div id=\"banner\">\n");
      out.write("                </div>\n");
      out.write("            </div>\n");
      out.write("            <hr width=\"850\">\n");
      out.write("            <div id=\"pagebody\">\n");
      out.write("                <div id=\"leftside\">\n");
      out.write("                    <div id=\"selfphoto\">\n");
      out.write("                        <img id=\"selfphoto\" border=\"2\" src=\"");
      out.print(host_photo_path);
      out.write("\"><br><br>\n");
      out.write("                        ");
      out.print(user_name);
      out.write("的头像\n");
      out.write("                    </div>\n");
      out.write("                    <hr>\n");
      out.write("                    <div id=\"managementlink\">\n");
      out.write("                        <a href=\"addMessage.jsp\" target=\"iframe\">给我留言</a>\n");
      out.write("                        <a href=\"\">加为好友</a><br /><br />\n");
      out.write("                        <a href=\"albums.jsp?user_id=");

      out.write("\" target=\"iframe\">管理相册</a>\n");
      out.write("                        <a href=\"addDiary.jsp\" target=\"iframe\">发表日志</a><br /><br />\n");
      out.write("                        <a href=\"articlelist.jsp\">进入论坛</a>\n");
      out.write("                        <a href=\"\" target=\"iframe\">管理贴子</a>\n");
      out.write("                    </div> \n");
      out.write("                    <hr />\n");
      out.write("                    <div id=\"visiters\">\n");
      out.write("                        <div id=\"visiters_head\">最近访问的用户</div>\n");
      out.write("                        ");
                        ArrayList<String> friends = TimeMaker.getFriends(last_visit);                        DataBase db1 = new DataBase();                        ResultSet rs1 = null;                        db1.connectToDB();                        String sql = "";                        for(int i=0; i<friends.size(); i++){                            String friendId = friends.get(i);                            sql = "select user_name, photo_path from users where user_id = " + friendId;                            rs1 = db1.executeQuery(sql);                            String visit_name = "";                            String photo_path = "";                            if(rs1.next()){                                 visit_name = rs1.getString(1);                                 photo_path = rs1.getString(2);                            }                        
      out.write("\n");
      out.write("                            <div class=\"visiter\">\n");
      out.write("                                <a href=\"homepage.jsp?be_visited_id=");
      out.print(friendId);
      out.write("\"><div align=\"left\" class=\"visiter_body\"><img class=\"visiter_picture\" src=\"");
      out.print(photo_path);
      out.write("\"></img></div><div class=\"visiter_details\">");
      out.print(visit_name);
      out.write("</div></a>\n");
      out.write("                            </div>\n");
      out.write("                        ");
                        }                        
      out.write("\n");
      out.write(" \n");
      out.write("                    </div>\n");
      out.write("                    <hr />\n");
      out.write("                    <div id=\"datecount\" align=\"left\">\n");
      out.write("                        数据统计:\n");
      out.write("                        <div id=\"visitercount\">访问量:");
      out.print(visit_account);
      out.write("</div>\n");
      out.write("                        <div id=\"createdate\">建立日期:");
      out.print(create_time);
      out.write("</div>\n");
      out.write("                        <div id=\"updatedate\">更新时间:</div>\n");
      out.write("                    </div>\n");
      out.write("                </div>\n");
      out.write("                <div STYLE=\"width:580px; height:100%\">\n");
      out.write("                    <iframe frameborder=\"0\" width=\"580px\" height=\"600px\" onload = \"height = this.Document.body.scrollHeight + 30;\" name=\"iframe\" src=\"messages.jsp\"></iframe>\n");
      out.write("                </div>\n");
      out.write("            </div>\n");
      out.write("            <div id=\"footer\">\n");
      out.write("                <div id=\"footer_text\">\n");
      out.write("                    版权所有:ZER&nbsp;&nbsp;&nbsp;邮箱&nbsp;&nbsp;<a href=\"#\">zerxd@126.com</a>\n");
      out.write("                </div>\n");
      out.write("            </div>\n");
      out.write("        </div>\n");
      out.write("    </body>\n");
      out.write("    ");
db.close();
      out.write("\n");
      out.write("</html>\n");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          try { out.clearBuffer(); } catch (java.io.IOException e) {}
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -