posts - 18,comments - 26,trackbacks - 0

          功能描述:顯示當日教師發布的所有作業

          關鍵代碼說明:

          <table width="100%" border="0" >

          <tr>

          <td colspan="4"><hr></td>

          </tr>

          <%

          int intPageSize;//每頁顯示的記錄條數

          int intRowCount;//總記錄數

          int intPageCount;//總頁數

          int intPage;//提交的頁碼

          String strPage;//當前頁碼

          int ii;

          intPageSize=4;

          strPage=request.getParameter("page");

          if(strPage==null){

          intPage=1;

          }

          else{

          intPage=java.lang.Integer.parseInt(strPage);

          if (intPage<1)intPage=1;

          }

          String sql1="select * from main where date='"+yearmonth+"' order by date desc";

          rst=stmt.executeQuery(sql1);

          rst.last();

          intRowCount=rst.getRow();

          intPageCount=(intRowCount+intPageSize-1)/intPageSize;//計算總頁數

          if (intPage>intPageCount) intPage=intPageCount;//提交的頁數大于總頁數

          if(intPageCount>0){

          rst.absolute((intPage-1)*intPageSize+1); //移動記錄指針到待顯示記錄上

          ii=0;

          while (ii<intPageSize&&!rst.isAfterLast()){

          %>

          <tr>

          <td height="20" colspan="4" bgcolor="#eaeaea">

          <div align="left"><strong><a href="content.jsp?id=<%=rst.getString("mainid")%>">

          <%=trans(rst.getString("title"))%></a></strong></div></td>

          </tr>

          <tr>

          <td   colspan="4" background="pics/dot_line.gif" height="1"></td>

          </tr>

          <tr><td colspan="4"><%

          String  co=rst.getString("content").toString();

          int len=co.length();

          if(len<100)

          {

          String content=co.substring(0,len);

          out.print(trans(content));

          out.print("……");

          }else{

          String content=co.substring(0,100);

          out.print("……");

          }

          %></td></tr>

          <tr>

          <td   colspan="4" background="pics/dot_line.gif" height="1"></td>

          </tr>

          <tr>

          <td width="32%"><div align="right"><a href="content.jsp?id=<%=rst.getString("mainid")%>">

          閱讀全文</a>&nbsp;&nbsp;</div></td>

          <td width="24%">作業類型:&nbsp;

          <%

          String typeid=rst.getString("typeid");

          Connection con2=n.getConnection();

          Statement stmt2=con2.createStatement();

          String sql2="select * from type where typeid='"+typeid+"'";

          ResultSet rst2=stmt2.executeQuery(sql2);

          if(rst2.next()){

          out.print(trans(rst2.getString("typename")));

          }

          rst2.close();

          stmt2.close();

          con2.close();

          %>&nbsp;&nbsp;

          </td>

          <td width="19%">作者:&nbsp; <%

          String id=rst.getString("teacherid");

          Connection conn=n.getConnection();

          Statement stmtt=conn.createStatement();

          String Sql="select * from teacher where teacherid='"+id+"'";

          ResultSet rstt=stmtt.executeQuery(Sql);

          while(rstt.next()){

          out.print(trans(rstt.getString("teachername")));

          rstt.close();

          stmtt.close();

          conn.close();

          %>&nbsp;&nbsp;</td>

          <td width="25%">日期:<%=rst.getString("date").substring(0,10)%></td>

          </tr>

          <tr>

          <td colspan="4" ><hr></td>

          </tr>

          <%

          rst.next();

          ii++;

          }

          }

          %>

          <tr>

          <TD colspan="4"><form  action="showdaywork.jsp" method="post">

          <div align="right"><%=intPage%>&nbsp;&nbsp;<%=intPageCount%>&nbsp;&nbsp;

          <%if(intPage<intPageCount){%>

          <a href="showdaywork.jsp?page=<%=intPage+1%>&yearmonth=<%=yearmonth%>">

          下一頁</a>

          <%}%>

          &nbsp;&nbsp;

          <%if(intPage>1){%>

          <a href="showdaywork.jsp?page=<%=intPage-1%>&yearmonth=<%=yearmonth%>">上一頁</a>

          <%}%>

          <a   href="#" onClick="history.go(-1);">返回</a> </div>

          </form></TD>

           </tr>

          </table>

          posted on 2005-06-01 10:09 瘦猴 閱讀(447) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 武定县| 陆川县| 新丰县| 瑞昌市| 广丰县| 庄河市| 和田市| 淳安县| 祁连县| 曲阳县| 淮南市| 枞阳县| 全南县| 东山县| 泰和县| 当涂县| 崇文区| 西贡区| 衡水市| 米泉市| 湄潭县| 延津县| 江山市| 彭阳县| 三亚市| 云和县| 乃东县| 治县。| 化德县| 英山县| 连南| 安福县| 达孜县| 闻喜县| 安宁市| 积石山| 牙克石市| 苍山县| 尼木县| 探索| 朝阳区|