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 瘦猴 閱讀(446) 評論(0)  編輯  收藏

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


          網站導航:
           
          主站蜘蛛池模板: 乌什县| 北海市| 马关县| 阳山县| 临邑县| 隆安县| 宁波市| 安顺市| 新宾| 辛集市| 莱阳市| 威海市| 桃江县| 盐边县| 金昌市| 香格里拉县| 南川市| 游戏| 绥德县| 清涧县| 怀化市| 崇明县| 伊春市| 容城县| 张家口市| 庄浪县| 嘉鱼县| 营口市| 花莲县| 安陆市| 安吉县| 定西市| 安图县| 师宗县| 杭锦后旗| 韶关市| 井冈山市| 梁河县| 安图县| 抚顺市| 四子王旗|