listblog.jsp
上传用户:jhtang88
上传日期:2014-01-27
资源大小:28528k
文件大小:4k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html;charset=utf-8"%>
  2. <%@ page import="com.redmoon.blog.*"%>
  3. <%@ page import="com.redmoon.forum.MsgDb"%>
  4. <%@ page import="com.redmoon.forum.person.UserDb"%>
  5. <%@ page import="cn.js.fan.db.*"%>
  6. <%@ page import="cn.js.fan.util.*"%>
  7. <%@ page import="java.util.*"%>
  8. <%@ page import="cn.js.fan.web.*"%>
  9. <%@ taglib uri="/WEB-INF/tlds/LabelTag.tld" prefix="lt" %>
  10. <html>
  11. <head>
  12. <%
  13. String title = SkinUtil.LoadString(request,"res.label.blog.list", "listblog_title");
  14. title = StrUtil.format(title, new Object[] {Global.AppName});
  15. %>
  16. <title><%=title%></title>
  17. <LINK href="common.css" type=text/css rel=stylesheet>
  18. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  19. <style type="text/css">
  20. <!--
  21. .style1 {font-size: 14px;
  22. font-weight: bold;
  23. }
  24. -->
  25. </style>
  26. </head>
  27. <body>
  28. <%@ include file="blog_header.jsp"%>
  29. <table width="892" border="0" align="center" cellpadding="0" cellspacing="0">
  30.   <tr>
  31.     <td bgcolor="#F7F7F7" class="line4t" valign="top"><table width="96%" border="0" cellspacing="0" cellpadding="0">
  32.       <tr>
  33.         <td>&nbsp;</td>
  34.       </tr>
  35.       <tr>
  36.         <td><%
  37. UserConfigDb ucd = new UserConfigDb();
  38. String kind = ParamUtil.get(request, "kind");
  39. Leaf lf = new Leaf();
  40. if (!kind.equals("")) {
  41. lf = lf.getLeaf(kind);
  42. if (lf==null || !lf.isLoaded()) {
  43. out.print(SkinUtil.makeErrMsg(request,SkinUtil.LoadString(request,"res.label.blog.list","not_class")));
  44. return;
  45. }
  46. String strcurpage = StrUtil.getNullString(request.getParameter("CPages"));
  47. if (strcurpage.equals(""))
  48. strcurpage = "1";
  49. if (!StrUtil.isNumeric(strcurpage)) {
  50. out.print(StrUtil.makeErrMsg(SkinUtil.LoadString(request, "err_id")));
  51. return;
  52. }
  53. String sql;
  54. if (kind.equals(""))
  55. sql = "select userName from " + ucd.getTableName() + " ORDER BY addDate desc";
  56. else
  57. sql = "select userName from " + ucd.getTableName() + " where kind=" + StrUtil.sqlstr(kind) + " ORDER BY addDate desc";
  58.     int total = 0;
  59. int pagesize = 20;
  60. int curpage = Integer.parseInt(strcurpage);
  61. ListResult lr = ucd.ListBlog(sql, curpage, pagesize);
  62. total = lr.getTotal();
  63. Paginator paginator = new Paginator(request, total, pagesize);
  64. // 设置当前页数和总页数
  65. int totalpages = paginator.getTotalPages();
  66. if (totalpages==0)
  67. {
  68. curpage = 1;
  69. totalpages = 1;
  70. }
  71.         Iterator ir = lr.getResult().iterator();
  72. %>
  73.             <table width="98%" border="0" class="p9">
  74.               <tr>
  75.                 <td align="right"><%=paginator.getPageStatics(request)%></td>
  76.               </tr>
  77.             </table>
  78.           <%
  79. while (ir.hasNext()) {
  80.     ucd = (UserConfigDb) ir.next(); 
  81.   %>
  82.             <table bordercolor=#edeced cellspacing=0 cellpadding=5 width="98%" align=center border=0>
  83.               <tbody>
  84.                 <tr>
  85.                   <td width="77%" align=left bgcolor=#f8f8f8><a href="myblog.jsp?userName=<%=StrUtil.UrlEncode(ucd.getUserName())%>"><%=ucd.getTitle()%></a></td>
  86.                   <td width="23%" align=left bgcolor=#f8f8f8><%=DateUtil.format(ucd.getAddDate(), "yy-MM-dd")%></td>
  87.                 </tr>
  88.                 <tr>
  89.                   <td height=1 colspan="2" align=left background="../images/comm_dot.gif"></td>
  90.                 </tr>
  91.               </tbody>
  92.             </table>
  93.           <%}%>
  94.             <table width="98%" border="0" cellspacing="1" cellpadding="3" align="center" class="9black">
  95.               <tr>
  96.                 <td height="23" align="right"><%
  97. String querystr = "";
  98. out.print(paginator.getPageBlock(request,"?"+querystr));
  99. %>
  100.                   &nbsp;&nbsp;</td>
  101.               </tr>
  102.           </table></td>
  103.       </tr>
  104.     </table></td>
  105.     <td width="2"></td>
  106.     <td width="260" valign="top" bgcolor="#F7F7F7" class="line4t"><%@ include file="blog_left.jsp"%></td>
  107.   </tr>
  108.   <tr>
  109.     <td height="10"></td>
  110.   </tr>
  111. </table>
  112. <%@ include file="footer.jsp"%>
  113. </body>
  114. </html>