📄 frontpage.jsp
字号:
<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*,ArticleSharing.DBTools" errorPage="" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head> <style>a{TEXT-DECORATION:none}</style><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>首页</title><style type="text/css"><!--.STYLE1 { font-size:80px; font-weight: bold;}--></style></head> <style type="text/css"> <!-- .STYLE1 { color: #FF0000; font-weight: bold; font-size: large; } body { background-image: url(photoes/bg.gif); } --> </style><body><div style="width:850px;height:auto; margin-left:65px;background-color: #ffffff;" align="center"> <div style="width:850px;" id="head" align="center"> <div style="float:left;background-color: #000000;height:100px;"> <td><img src="photoes/logo.gif"></td> </div> <div style="float:right;height:100px;width:595px;background-color: #000000;"> <div style="margin-top:20px;margin-right:20px;font-size:30px;font-family: fantasy;color: #ffffff;">ALL--ST@R . FOURM</div> <div style="margin-top:10px; margin-right:100px;"> <div style="float:right; color:#ffffff;margin-right:20px;"><a href="homepage.jsp"><STRONG>个人主页</STRONG></a></div> <div style="float:right;color:#ffffff;margin-right:20px;"><a href="change.jsp"><STRONG>修改资料</STRONG></a></div> <div style="float:right;color:#ffffff;margin-right:20px;"><a href="search.jsp"><STRONG>搜索</STRONG></a></div> <div style="float:right;color:#ffffff; margin-right:20px;"><a href="articlelist.jsp"><STRONG>论坛</STRONG></a></div> <div style="float:right;color:#ffffff; margin-right:20px;"><a href="upload.html"><STRONG>上传头像</STRONG></a></div> </div> </div> </div> <hr> <% DBTools tool_1 = new DBTools(); DBTools tool_2 = new DBTools(); ResultSet rs_1 = tool_1.excuteQuery("select post_id ,post_title from posts order by response_quantity desc"); ResultSet rs_2 = tool_2.excuteQuery("select post_id ,post_title from posts order by post_date desc"); String post = "detiles.jsp"; %> <div> <div style="text-align:left;margin-left:40px;"><p class="STYLE1">论坛风云</p></div> <div style="margin-left:20px;"> <div style="float:left; width:150px;text-align:left;">历久弥香的好贴</div> <div style="width:150px;text-align:left;">新鲜出炉的好贴</div> <hr> </div> <% if(rs_1 != null) for(int i = 0;i < 5 ;i++) { if(rs_1.next()&&rs_2.next()) { int id_1 = rs_1.getInt("post_id"); int id_2 = rs_2.getInt("post_id"); %> <div style="margin-top:10px;margin-left:40px;"> <div style="float:left; width:150px;text-align:left;"><a href="<%=post%>?id=<%=id_1%>"><%=rs_1.getString("post_title")%></a></div> <div style="width:150px; text-align:left;"><a href="<%=post%>?id=<%=id_2%>"><%=rs_2.getString("post_title")%></a></div> </div> <% } else break; } %> </table></div><hr><div style="text-align:left; margin-left:40px;"><p class="STYLE1">人气之星</p></div><div> <% DBTools tool_3 = new DBTools(); ResultSet rs_3 = tool_3.excuteQuery("select user_id ,user_name,photo_path from users order by visitor_count desc"); String user = "homepage.jsp"; String path = ""; %> <tr> <% for(int i = 0;i < 4 && rs_3.next();i++) { path = rs_3.getString("photo_path"); %> <td width=152 ><a href= <%=user%>?be_visited_id=<%=rs_3.getInt("user_id")%>><img style="width:150px;" src=<%=path%> /></a></td> <% } %> </tr> <tr> <% for(int i = 0;i < 4 && rs_3.next();i++) { path = rs_3.getString("photo_path"); %> <td width=152 ><a href=<%=user%>?be_visited_id=<%=rs_3.getInt("user_id")%>><img style="width:150px;" src=<%=path%> /></a></td> <% } %> </tr> <tr> <% for(int i = 0;i < 4 && rs_3.next();i++) { path = rs_3.getString("photo_path"); %> <td width=152 ><a href= <%=user%>?be_visited_id=<%=rs_3.getInt("user_id")%>><img style="width:150px;" src=<%=path%> /></a></td> <% } %> </tr></div><hr> <p> </p> <% DBTools tool_4 = new DBTools(); ResultSet rs_4= tool_4.excuteQuery("select diary_id,diarymaker_id,diary_title,visits_account from diary order by visits_account desc"); String diary = "frontpage.jsp"; %> <div style="margin-left:40px;text-align:left;"><p class="STYLE1">美文推荐</p></div> <table width="640" height="135" border="1" bordercolor="#000000"> <tr> <th width="467" scope="col">文章题目</th> <th width="157" scope="col">点击率</th> </tr> <% for(int i = 0;i < 4 && rs_4.next() ;i++) { out.println("<tr>"); out.println("<td><a href=" + diary + "?user_id=" + rs_4.getInt("diarymaker_id") + ">" + rs_4.getString("diary_title") + "</td>"); out.println("<td>" + rs_4.getInt("visits_account") + "</td>"); out.println("</tr>"); } %> </table> <p> </p> <p> </p></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -