英特內軟體股份有限公司


jcx.servlet.common
Class multiPageServlet

jcx.servlet.Servlet
  |
  +--jcx.servlet.common.htmlServlet
        |
        +--jcx.servlet.common.multiPageServlet
Direct Known Subclasses:
forumServlet

public abstract class multiPageServlet
extends htmlServlet

分頁查詢。
取得分頁:
       若總頁數(PAGE_AMOUT)=5,表示分為五頁,1.html~5.html
       Hyper Link:<a href='/"+PAGE_TEMP_PATH+PAGE_TEMP+"1.html'>第一頁</a>
                   <a href='/"+PAGE_TEMP_PATH+PAGE_TEMP+"2.html'>第二頁</a>
                   <a href='/"+PAGE_TEMP_PATH+PAGE_TEMP+"3.html'>第三頁</a>
                   <a href='/"+PAGE_TEMP_PATH+PAGE_TEMP+"4.html'>第四頁</a>
                   <a href='/"+PAGE_TEMP_PATH+PAGE_TEMP+"5.html'>第五頁</a>
Ex:

import java.io.*;
import jcx.servlet.common.*;
import yen.db.talk; 

public class multipage_test extends multiPageServlet {
   public String getPageHead(){
     return "<html><body><H2> MultiPage  Query</h2>";
   }
   public String getPageTail(){
     return "<H2> This is Page Tail </h2></body></html>";
   }
   public void action(PrintStream out){
     String data[][]=talk.sendmsgx("selectx","select * from KO_PRO2 where PROD_ID<300");
     for(int i=0;i<data.length;i++){
       if( i % 100 ==0){
         out=newPage();
       }
       out.println(getPageHead());
       //資料寫入
       for(int j=0;j<data[i].length;j++)  out.println("<h3>"+data[i][j]+"</h3>");
       out.println(getPageTail());
     }
     //分頁Link
     out=getOutputStream();
     for(int i=1;i<=PAGE_AMOUNT;i++)
     {
         out.println("<a href='/"+PAGE_TEMP_PATH+PAGE_TEMP+i+".html'>["+i+"]</a>");
     }
   }
}


Field Summary
protected  int PAGE_AMOUNT
           PAGE_AMOUNT 總共頁數
protected  java.lang.String PAGE_TEMP
           PAGE_TEMP 資料所暫存的目錄 格式:西元年月日時分秒微秒/ ex: 2000年10月25日9點03分25秒123微秒寫檔 2000102590325123/
protected  java.lang.String PAGE_TEMP_PATH
           存檔的根目錄
 
Fields inherited from class jcx.servlet.Servlet
files, req, resp
 
Constructor Summary
multiPageServlet()
           
 
Method Summary
protected abstract  void action(java.io.PrintStream out)
           程式由action()開始
protected abstract  java.lang.String getPageHead()
          頁面所需的開頭標題
protected abstract  java.lang.String getPageTail()
          頁面所需的結尾
 java.io.PrintStream newPage()
           newPage資料的處理
 void run1()
          Servlet 程式的進入點,程式由 run1 開始執行
 
Methods inherited from class jcx.servlet.Servlet
addCookie, checkClientTrusted, checkServerTrusted, decode, equals, fromEscapeCode, getAcceptedIssuers, getClientProperty, getCookies, getFileInputStream, getFormData, getHeader, getInputStream, getMemoryInputStream, getMethod, getOutputStream, getParameter, getPath, lzw_decompress, returnAuthenticateResponse, returnAuthenticateResponse, returnErrorResponse, returnNormalResponse, run, setHeader, ToHtml, ToSql, verify
 

Field Detail

PAGE_AMOUNT

protected int PAGE_AMOUNT
PAGE_AMOUNT 總共頁數

PAGE_TEMP

protected java.lang.String PAGE_TEMP
PAGE_TEMP 資料所暫存的目錄
格式:西元年月日時分秒微秒/
ex:
2000年10月25日9點03分25秒123微秒寫檔

         2000102590325123/

PAGE_TEMP_PATH

protected final java.lang.String PAGE_TEMP_PATH
存檔的根目錄
Constructor Detail

multiPageServlet

public multiPageServlet()
Method Detail

run1

public void run1()
Description copied from class: Servlet
Servlet 程式的進入點,程式由 run1 開始執行
Overrides:
run1 in class htmlServlet
Following copied from class: jcx.servlet.Servlet
Returns:
none
Throws:
java.lang.Exception - if any Exception.

newPage

public final java.io.PrintStream newPage()
newPage資料的處理
Returns:
PrintStream 回傳一個資料流

getPageHead

protected abstract java.lang.String getPageHead()
頁面所需的開頭標題

getPageTail

protected abstract java.lang.String getPageTail()
頁面所需的結尾

action

protected abstract void action(java.io.PrintStream out)
程式由action()開始
Parameters:
out - PrintStream
See Also:
newPage()

英特內軟體股份有限公司