JSP technology page

  Abstract: JSP technology page 

  </ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle"> <table width="722" border="0"> <tr> <td> </ td> </ tr> </ table> 

  The current widespread use of the paging option is to cache query results in the HttpSession or state bean, the time from turning the pages out of a cache data.    Such an approach has two major drawbacks: First, users may see is measured data; Second, if the volume of data is very large for the first time spent traversing the results of assembly for a long time, and cache data will take up much of memory, efficiency has declined markedly. 
  Other common methods are also on each page-a database, only removed from a ResultSet data (using rs.last (); rs.getRow (), and was recorded of the total number, use rs.absolute () positioning Go to Start records).    In some ways this database (such as oracle) JDBC is the need to achieve almost all records traversing experimental proof in the record number of large, very slow speed. 
  As for the cache result sets ResultSet methods are is a completely wrong approach.    ResultSet because Connection closed or in the Statement will also be closed, if prolonged occupation will ResultSet effective database connection. 

  Pagination therefore relatively good practice should be the time to turn the pages, each from a database search page size of the data block.    Although each page-this need to query the database, but for a very small number of records, not data transmission network, the use of connection pool can be the most time-consuming little more than the establishment of a database linking process.    In the database and a variety of mature-optimization techniques used to enhance the speed of enquiries than in the application server cache done more effectively. 

  In oracle database query results, the Bank said that the use of pseudo-out ROWNUM (from the beginning).    For example, select * from employee where rownum <10 return to the previous record of 10.    But since rownum in enquiries after the sort of assignment before, so for employee birthday by the sort 100-120 record should write: 
  [Pre] select * from ( 
  Select my_table .*, rownum as my_rownum from ( 
  Select name, birthday from employee order by birthday 
  ) My_table where rownum <120 
  ) Where my_rownum> = 100 
  [/ Pre] 
  MySQL can use the LIMIT clause: 
  Select name, birthday from employee order by birthday LIMIT 99,20 
  DB2 has rownumber () function to access the current line number. 
  SQL Server not studied, can refer to the article: http://www.csdn.net/develop/article/18/18627.shtm 

  In the process of Web page will be frequently used, but the realization of the details page programming is trouble in the course of things.    Most of the paging display query operation at the same time to deal with complex multiple search criteria, sql statement needs dynamic mosaic composition, coupled with the need for paging record positioning, the total number of records, as well as the result of a query on Ergodic, Packaging, and that process will become very complex and difficult to understand.    Some of the tools needed to streamline category paging code, programmers focus on the business logic part.    Below are the two I design tools categories: 
  PagedStatement Packaging, a database connection, the record number of enquiries, paging enquiries, outcome data package and the closure of operations such as database connectivity, support and the use of dynamic setting parameters PreparedStatement. 
  PetStore RowSetPage reference to the page by page iterator pattern for Packaging Design RowSetPage query results (using OracleCachedRowSet from a cache for data on the use of database query results CachedRowSet Packaging, please refer to JSP pages enquiries revealed that commonly used models) as well as the current paginated, and the total number of records, the current record number, and other information, and can generate simple HTML page code. 
  PagedStatement the results of inquiries into RowsetPage package. 

  Below is the use of simple examples: 


  / / DAO data for some of the code: 
…
  Public RowSetPage getEmployee (String gender, int pageNo) throws Exception ( 
  String sql = "select emp_id, emp_code, user_name, real_name from employee where gender =?"; 
  / / Oracle Database tab for realization per page 5 
  PagedStatement pst = new PagedStatementOracleImpl (sql, pageNo, 5); 
  Pst.setString (1, gender); 
  Return pst.executeQuery (); 
  ) 


  / / Servlet handle enquiries request of the code: 

…
  Int pageNo; 
  Try ( 
  / / Pageno parameters can be obtained through the user's selection of a page 
  PageNo = Integer.parseInt (request.getParameter ( "pageno")); 
  ) Catch (Exception ex) ( 
  / / The default is the first page 
  PageNo = 1; 
  ) 
  String gender = request.getParameter ( "gender"); 
  Request.setAttribute ( "empPage" myBean.getEmployee (gender, pageNo)); 
…

  / / JSP showed some code 
  <% @ Page import = "page.RowSetPage"%> 
…
  <script Language="javascript"> 
  Function doQuery () ( 
  Form1.actionType.value = "doQuery"; 
  Form1.submit (); 
  ) 
  </ Script> 
…
  <form Name=form1 method=get> 
  <input Type=hidden name=actionType> 
  Sex: 
  <Input type = text name = gender size = 1 value ="<%= request.getParameter ( "gender ")%>"> 
  <input Type=button value="查询" onclick="doQuery()"> 
<%
  RowSetPage empPage = (RowSetPage) request.getAttribute ( "empPage"); 
  If (empPage == null) = RowSetPage.EMPTY_PAGE empPage; 
%>
…
  <table Cellspacing="0" width="90%"> 
  <tr> <td> ID </ td> <td> code </ td> <td> user name </ td> <td> name </ td> </ tr> 
<%
  Javax.sql.RowSet empRS = (javax.sql.RowSet) empPage.getRowSet (); 
  If (empRS! = Null) while (empRS.next ()) ( 
%>
<tr>
  <td> <% = EmpRS.getString ( "EMP_ID ")%></ td> 
  <td> <% = EmpRS.getString ( "EMP_CODE ")%></ td> 
  <td> <% = EmpRS.getString ( "USER_NAME ")%></ td> 
  <td> <% = EmpRS.getString ( "REAL_NAME ")%></ td> 
  </ Tr> 
<%
  ) / / End while 
%>
<tr>
<%
  / / Show the total number of pages and the current page (pageno), as well as paging code. 
  / / Here doQuery pages submitted for action on the javascript function name, logo pageno for the parameters of the current page 
%>
  <td Colspan=4> <% = empPage. GetHTML ( "doQuery", "pageno ")%></ td> 
  </ Tr> 
  </ Table> 
  </ Form> 

  Figure effect: 


  Pagination will show that because of the general conditions and with enquiries for action, the page should have a check on the conditions and methods for the javascript (as in the above doQuery), the RowSetPage.getHTML () generated paging code on the user choice new page directly in front of the callback to deal with enquiries javascript methods.    Attention to the outcome of the enquiries revealed that the last time on the need to maintain conditions, such as <input type = text name = gender size = 1 value ="<%= request.getParameter ( "gender ")%>">.    At the same time as the parameters of a page can be designated, and therefore support in the same pages in a number of paging zones. 
  Another paging code is generated for each page URL, page inquiry parameters and attached to the URL as QueryString behind.    This method is the deficiencies in the conditions for dealing with complex, difficult, and the need for action designated to deal with the servlet, and may not be suitable for certain custom query operation. 
  If the RowSetPage.getHTML () generation is not satisfied with the default code page can be dealt with the preparation of their own paging code RowSetPage provide many getter methods are used to get the relevant information (such as the current page, total pages, the total number of records and the current record number, etc.). 
  In practical application can be made and shown on page jsp taglib to further streamline the JSP code, shielding Java Code. 

  Attachment: Paging Tool of the source code, the Notes should be very easy to understand. 

1.Page.java
  2.RowSetPage.java (RowSetPage succession Page) 
3.PagedStatement.java
  4.PagedStatementOracleImpl.java (PagedStatementOracleImpl succession PagedStatement) 

  You can use any source code, but the word must be preserved author evan_zhao@hotmail.com 


///////////////////////////////////
  / / 
  / / Page.java 
  / / Author: evan_zhao@hotmail.com 
  / / 
///////////////////////////////////

  Package page; 

  Import java.util.List; 
  Import java.util.ArrayList; 
  Import java.util.Collection; 
  Import java.util.Collections; 


  / ** 
  * Title: paging object 

  * Description: Information contained data and paging targets 

  * Page class implements used to display basic information page, but not specified the type of data contained, 
  * According to the need to achieve a particular way of organizing the data-type, 

  * RowSetPage to RowSet package data, the data package ListPage to List 

  * Copyright: Copyright (c) 2002 

  * @ Author evan_zhao@hotmail.com 

  * @ Version 1.0 
  * / 
  Public class Page implements java.io.Serializable ( 
  Public static final Page EMPTY_PAGE = new Page (); 
  Public static final int DEFAULT_PAGE_SIZE = 20; 
  Public static final int MAX_PAGE_SIZE = 9999; 

  Private int myPageSize = DEFAULT_PAGE_SIZE; 

  Private int start; 
  Private int avaCount, totalSize; 
  Private Object data; 

  Private int currentPageno; 
  Private int totalPageCount; 

  / ** 
  * The default constructor, the only empty page structure 
  * / 
  Protected Page () ( 
  This.init (0,0,0, DEFAULT_PAGE_SIZE, new Object ()); 
  ) 

  / ** 
  * Initial data paging, call by the subclass 
  * @ Param start page data in the database in the initial position 
  * @ Param avaCount page contains data of the number of 
  * @ Param totalSize database records of the total number of 
  * @ Param pageSize page capacity 
  * @ Param data page contains data 
  * / 
  Protected void init (int start, int avaCount, int totalSize, int pageSize, Object data) ( 

  This.avaCount = avaCount; 
  This.myPageSize = pageSize; 

  This.start = start; 
  This.totalSize = totalSize; 

  This.data = data; 

  / / System.out.println ( "avaCount:" + avaCount); 
  / / System.out.println ( "totalSize:" + totalSize); 
  If (avaCount> totalSize) ( 
  / / Throw new RuntimeException ( "record of the total number of more than a few ?!"); 
  ) 

  This.currentPageno = (start -1) / pageSize +1; 
  This.totalPageCount = (totalSize pageSize + -1) / pageSize; 

  If (totalSize == 0 & & avaCount == 0) ( 
  This.currentPageno = 1; 
  This.totalPageCount = 1; 
  ) 
  / / System.out.println ( "Start Index to Page No:" + start + "-" + currentPageno); 
  ) 

  Public Object getData () ( 
  Return this.data; 
  ) 

  / ** 
  * Data from this page capacity (this page will contain the record number) 
  * @ Return the records page can include several 
  * / 
  Public int getPageSize () ( 
  Return this.myPageSize; 
  ) 

  / ** 
  * Whether there is a Next 
  * @ Return whether there is a Next 
  * / 
  Public boolean hasNextPage () ( 
  / * 
  If (avaCount == 0 & & totalSize == 0) ( 
  Return false; 
  ) 
  Return (+ start avaCount -1) <totalSize; 
  * / 
  Return (this.getCurrentPageNo () <this.getTotalPageCount ()); 

}

  / ** 
  * Whether there is a previous 
  * @ Return whether there is a previous 
  * / 
  Public boolean hasPreviousPage () ( 
  / * 
  Return start> 1; 
  * / 
  Return (this.getCurrentPageNo ()> 1); 
  ) 

  / ** 
  * Access to the first page of the data in the database location 
  * @ Return 
  * / 
  Public int getStart () ( 
  Return start; 
  ) 

  / ** 
  * Get the current page final data in the database in a position 
  * @ Return 
  * / 
  Public int getEnd () ( 
  Int end = this.getStart () + this.getSize () -1; 
  If (end <0) ( 
  End = 0; 
  ) 
  Return end; 
  ) 

  / ** 
  * Previous first access data in the database of the location of 
  * @ Return records corresponding rownum 
  * / 
  Public int getStartOfPreviousPage () ( 
  Return Math.max (start-myPageSize, 1); 
  ) 


  / ** 
  * Get Next first data in the database of the location of 
  * @ Return records corresponding rownum 
  * / 
  Public int getStartOfNextPage () ( 
  + AvaCount return start; 
  ) 

  / ** 
  * Access to the first page of the data in the database location, number each page of the use of default values 
  * @ Param pageNo page, 
  * @ Return records corresponding rownum 
  * / 
  Public static int getStartOfAnyPage (int pageNo) ( 
  Return getStartOfAnyPage (pageNo, DEFAULT_PAGE_SIZE); 
  ) 

  / ** 
  * Access to the first page of the data in the database location 
  * @ Param pageNo page, 
  * @ Param pageSize few records per page 
  * @ Return records corresponding rownum 
  * / 
  Public static int getStartOfAnyPage (int pageNo, int pageSize) ( 
  Int startIndex = (pageNo-1) * pageSize + 1; 
  If (startIndex <1) startIndex = 1; 
  / / System.out.println ( "Page No to Start Index:" pageNo + + "-" + startIndex); 
  Return startIndex; 
  ) 

  / ** 
  * Page from the records contain few 
  * @ Return page contains a record number of 
  * / 
  Public int getSize () ( 
  Return avaCount; 
  ) 

  / ** 
  * From the database contains records of the total number of 
  * @ Return the database contains records of the total number of 
  * / 
  Public int getTotalSize () ( 
  Return this.totalSize; 
  ) 

  / ** 
  * From the current page 
  * @ Return the current page 
  * / 
  Public int getCurrentPageNo () ( 
  Return this.currentPageno; 
  ) 

  / ** 
  * From the page 
  * @ Return the page 
  * / 
  Public int getTotalPageCount () ( 
  Return this.totalPageCount; 
  ) 


  / ** 
*
  * @ Param queryJSFunctionName achieve paging JS script name, page will automatically change the method of correction 
  * @ Param pageNoParamName page parameter name 
  * @ Return 
  * / 
  Public String getHTML (String queryJSFunctionName, String pageNoParamName) ( 
  If (getTotalPageCount () <1) ( 
  Return "<input type='hidden' name='"+pageNoParamName+"' value='1'>"; 
  ) 
  If (queryJSFunctionName == null | | queryJSFunctionName.trim (). Length () <1) ( 
  QueryJSFunctionName = "gotoPage"; 
  ) 
  If (pageNoParamName == null | | pageNoParamName.trim (). Length () <1) ( 
  PageNoParamName = "pageno"; 
  ) 

  String gotoPage = "_" + queryJSFunctionName; 

  StringBuffer html = new StringBuffer ( "\ n"); 
  Html.append ( "<script language=\"Javascript1.2\"> \ n") 
  . Append ( "function"). Append (gotoPage). Append ( "(pageNo) (\ n") 
  . Append ( "var curPage = 1 \ n") 
  . Append ( "try (curPage = document.all [\" ") 
  . Append (pageNoParamName). Append ( "\"]. Value; \ n ") 
  . Append ( "document.all [\" "). Append (pageNoParamName) 
  . Append ( "\"]. Value = pageNo; \ n ") 
  . Append ( ""). Append (queryJSFunctionName). Append ( "(pageNo) \ n") 
  . Append ( "return true; \ n") 
  . Append ( ") catch (e) (\ n") 
  / / Append ( "try (\ n") 
  / / Append ( "document.forms [0]. Submit () \ n") 
  / / Append ( ") catch (e) (\ n") 
  . Append ( "alert ( 'not yet defined query methods: function") 
  . Append (queryJSFunctionName). Append ("()'); \ n ") 
  . Append ( "document.all [\" "). Append (pageNoParamName) 
  . Append ( "\"]. Value = curPage; \ n ") 
  . Append ( "return false; \ n") 
  / / Append ( ") \ n") 
  . Append ( ") \ n") 
  . Append ( ")") 
  . Append ( "</ script> \ n") 
  . Append ( ""); 
  Html.append ( "<table border=0 cellspacing=0 cellpadding=0 align=center width=80%> \ n") 

.append( ” <tr> \n”)
  . Append ( "<td align=left> 
  \ N "); 
  Html.append ( "total"). Append (getTotalPageCount ()). Append ( "pages") 
  . Append ( "["). Append (getStart ()). Append (".."). append (getEnd ()) 
  . Append ("/"). append (this.getTotalSize ()). Append ( "] \ n") 
  . Append ( "</ td> \ n") 
  . Append ( "<td align=right> \ n"); 
  If (hasPreviousPage ()) ( 
  Html.append ( "[. Append ("("). Append (getCurrentPageNo () -1) 
  . Append ( ") '> previous] \ n"); 
  ) 
  Html.append ( "") 
  . Append ( "<select name = '") 

.append(pageNoParamName).append(”‘ onChange=’javascript:”)

.append(gotoPage).append(”(this.value)’>   \ N "); 
  String selected = "selected"; 
  For (int i = 1; i <= getTotalPageCount (); i + +) ( 
  If (i == getCurrentPageNo ()) 
  Selected = "selected"; 
  Else selected = ""; 
  Html.append ( "<='"). append option value (i). Append (" ' ") 

.append(selected).append(”>   "). Append (i). Append (" </ option> \ n "); 
  ) 
  If (getCurrentPageNo ()> getTotalPageCount ()) ( 
  Html.append ( "<='"). append option value (getCurrentPageNo ()) 

.append(”‘ selected>   "). Append (getCurrentPageNo ()) 
  . Append ( "</ option> \ n"); 
  ) 
  Html.append ( "</ select> page \ n"); 
  If (hasNextPage ()) ( 
  Html.append ( "[. Append ("("). append ((getCurrentPageNo () +1)) 
  . Append ( ") '> Next] \ n"); 
  ) 
  Html.append ( "</ td> </ tr> </ table> \ n"); 

  Return html.toString (); 

  ) 
  ) 


///////////////////////////////////
  / / 
  / / RowSetPage.java 
  / / Author: evan_zhao@hotmail.com 
  / / 
///////////////////////////////////
  Package page; 

  Import javax.sql.RowSet; 


  / ** 
*

  Title: RowSetPage 


*

  Description: Use data paging RowSet objects Packaging 


*

  Copyright: Copyright (c) 2003 


  * @ Author evan_zhao@hotmail.com 
  * @ Version 1.0 
  * / 

  Public class RowSetPage extends Page ( 
  Private javax.sql.RowSet rs; 

  / ** 
  * Empty page 
  * / 
  Public static final RowSetPage EMPTY_PAGE = new RowSetPage (); 

  / ** 
  * The default constructor, creating an empty page 
  * / 
  Public RowSetPage () ( 
  This (null, 0,0); 
  ) 

  / ** 
  * Constructors paging object 
  * @ Param crs contains a data OracleCachedRowSet 
  * @ Param start page data in the database in the initial position 
  * @ Param totalSize database contains the records of the total number of 
  * / 
  Public RowSetPage (RowSet crs, int start, int totalSize) ( 
  This (crs, start, totalSize, Page.DEFAULT_PAGE_SIZE); 
  ) 

  / ** 
  * Constructors paging object 
  * @ Param crs contains a data OracleCachedRowSet 
  * @ Param start page data in the database in the initial position 
  * @ Param totalSize database contains the records of the total number of 
  * @ PageSize page to accommodate the record number 
  * / 
  Public RowSetPage (RowSet crs, int start, int totalSize, int pageSize) ( 
  Try ( 
  Int avaCount = 0; 
  If (crs! = Null) ( 
  Crs.beforeFirst (); 
  If (crs.next ()) ( 
  Crs.last (); 
  AvaCount = crs.getRow (); 
  ) 
  Crs.beforeFirst (); 
  ) 
  Rs = crs; 
  Super.init (start, avaCount, totalSize, pageSize, rs); 
  ) Catch (java.sql.SQLException sqle) ( 
  Throw new RuntimeException (sqle.toString ()); 
  ) 
  ) 

  / ** 
  * Paging object from the data records 
  * / 
  Public javax.sql.RowSet getRowSet () ( 
  Return rs; 
  ) 


  ) 


///////////////////////////////////
  / / 
  / / PagedStatement.java 
  / / Author: evan_zhao@hotmail.com 
  / / 
///////////////////////////////////

  Package page; 

  Import foo.DBUtil; 

  Import java.math.BigDecimal; 
  Import java.util.List; 
  Import java.util.Iterator; 
  Import java.util.Collections; 

  Import java.sql.Connection; 
  Import java.sql.SQLException; 
  Import java.sql.ResultSet; 
  Import java.sql.Statement; 
  Import java.sql.PreparedStatement; 
  Import java.sql.Timestamp; 
  Import javax.sql.RowSet; 

  / ** 
*

  Title: Paging enquiries 


*

  Description: According to a query on the page and the page data 


*

  Copyright: Copyright (c) 2002 


  * @ Author evan_zhao@hotmail.com 
  * @ Version 1.0 
  * / 
  (Public abstract class PagedStatement 
  Public final static int MAX_PAGE_SIZE = Page.MAX_PAGE_SIZE; 

  Protected String countSQL, querySQL; 
  Protected int pageNo, pageSize, startIndex, totalCount; 
  Protected javax.sql.RowSet rowSet; 
  Protected RowSetPage rowSetPage; 

  Private List boundParams; 

  / ** 
  * Constructors enquiries from all data PageStatement 
  * @ Param sql query sql 
  * / 
  Public PagedStatement (String sql) ( 
  This (sql, 1, MAX_PAGE_SIZE); 
  ) 


  / ** 
  * When a structure for a page of data PageStatement 
  * @ Param sql query sql 
  * @ Param pageNo page 
  * / 
  Public PagedStatement (String sql, int pageNo) ( 
  This (sql, pageNo, Page.DEFAULT_PAGE_SIZE); 
  ) 

  / ** 
  * When a structure for a page PageStatement data, and specify the number of records per page 
  * @ Param sql query sql 
  * @ Param pageNo page 
  * @ Param pageSize page capacity 
  * / 
  Public PagedStatement (String sql, int pageNo, int pageSize) ( 
  This.pageNo = pageNo; 
  This.pageSize = pageSize; 
  This.startIndex = Page.getStartOfAnyPage (pageNo, pageSize); 
  Collections.synchronizedList this.boundParams = (new java.util.LinkedList ()); 

  This.countSQL = "select count (*) from (" sql + + ")"; 
  This.querySQL = intiQuerySQL (sql, this.startIndex, pageSize); 
  ) 


  / ** 
  * Generation for a data sql statement 
  * @ Param sql original query 
  * @ StartIndex begin recording location 
  * @ Size needed to get the record number 
  * / 
  Protected abstract String intiQuerySQL (String sql, int startIndex, int size); 


  / ** 
  * Use the object is the value of parameter settings specified 
  * @ Param index for a first parameter, and the second for 2.    .    . 
  * @ Param obj the object contains parameters 
  * / 
  Public void setObject (int index, Object obj) (throws SQLException 
  BoundParam bp = new BoundParam (index, obj); 
  BoundParams.remove (bp); 
  BoundParams.add (bp); 
  ) 

  / ** 
  * Use the object is the value of parameter settings specified 
  * @ Param index for a first parameter, and the second for 2.    .    . 
  * @ Param obj the object contains parameters 
  * @ Param targetSqlType parameters of the database type 
  * / 
  Public void setObject (int index, Object obj, int targetSqlType) throws SQLException ( 
  BoundParam bp = new BoundParam (index, obj, targetSqlType); 
  BoundParams.remove (bp); 
  BoundParams.add (bp); 
  ) 

  / ** 
  * Use the object is the value of parameter settings specified 
  * @ Param index for a first parameter, and the second for 2.    .    . 
  * @ Param obj the object contains parameters 
  * @ Param targetSqlType parameters of the database type (constants defined in the java.sql.Types) 
  * @ Param scale accuracy, the median after the decimal point 
  * (Only targetSqlType Types.NUMBER or Types.DECIMAL is effective, while ignoring other types) 
  * / 
  Public void setObject (int index, Object obj, int targetSqlType, int scale) throws SQLException ( 
  BoundParam bp = new BoundParam (index, obj, targetSqlType, scale); 
  BoundParams.remove (bp); 
  BoundParams.add (bp); 
  ) 

  / ** 
  * Use the string is the value of parameter settings specified 
  * @ Param index for a first parameter, and the second for 2.    .    . 
  * @ Param str parameter contains the string value 
  * / 
  Public void setString (int index, String str) (throws SQLException 
  BoundParam bp = new BoundParam (index, str); 
  BoundParams.remove (bp); 
  BoundParams.add (bp); 
  ) 

  / ** 
  * Use the string is the value of parameter settings specified 
  * @ Param index for a first parameter, and the second for 2.    .    . 
  * @ Param timestamp value of the parameters contain timestamps 
  * / 
  Public void setTimestamp (int index, Timestamp timestamp) throws SQLException ( 
  BoundParam bp = new BoundParam (index, timestamp); 
  BoundParams.remove (bp); 
  BoundParams.add (bp); 
  ) 

  / ** 
  * Use given integer parameter settings specified value 
  * @ Param index for a first parameter, and the second for 2.    .    . 
  * @ Param value contains integer parameter values 
  * / 
  Public void setInt (int index, int value) throws SQLException ( 
  BoundParam bp = new BoundParam (index, new Integer (value)); 
  BoundParams.remove (bp); 
  BoundParams.add (bp); 
  ) 

  / ** 
  * Use is a long integer value of the parameter settings specified 
  * @ Param index for a first parameter, and the second for 2.    .    . 
  * @ Param value includes the value of long integer parameters 
  * / 
  Public void setLong (int index, long value) (throws SQLException 
  BoundParam bp = new BoundParam (index, the new Long (value)); 
  BoundParams.remove (bp); 
  BoundParams.add (bp); 
  ) 

  / ** 
  * Use double-precision floating point numbers are designated parameter values set 
  * @ Param index for a first parameter, and the second for 2.    .    . 
  * @ Param value of the parameter values include double-precision floating-point 
  * / 
  Public void setDouble (int index, the double value) throws SQLException ( 
  BoundParam bp = new BoundParam (index, the new Double (value)); 
  BoundParams.remove (bp); 
  BoundParams.add (bp); 
  ) 

  / ** 
  * Use BigDecimal given set of parameters specified value 
  * @ Param index for a first parameter, and the second for 2.    .    . 
  * @ Param bd value of the BigDecimal contains parameters 
  * / 
  Public void setBigDecimal (int index, BigDecimal bd) throws SQLException ( 
  BoundParam bp = new BoundParam (index, bd); 
  BoundParams.remove (bp); 
  BoundParams.add (bp); 
  ) 

  Private void setParams (PreparedStatement pst) throws SQLException ( 
  If (pst == null | | this.boundParams == null | | this.boundParams.size () == 0) return; 
  BoundParam param; 
  For (Iterator itr = this.boundParams.iterator (); itr.hasNext ();){ 
  Param = (BoundParam) itr.next (); 
  If (param == null) continue; 
  If (param.sqlType == java.sql.Types.OTHER) ( 
  Pst.setObject (param.index, param.value); 
  Else () 
  Pst.setObject (param.index, param.value, param.sqlType, param.scale); 
  ) 
  ) 
  ) 

  / ** 
  * Implementation of a data queries, after the closure of the implementation of the database connection 
  * @ Return RowSetPage 
  * @ Throws SQLException 
  * / 
  Public RowSetPage executeQuery () (throws SQLException 
  System.out.println ( "executeQueryUsingPreparedStatement"); 
  Connection conn = DBUtil.getConnection (); 
  PreparedStatement pst = null; 
  ResultSet rs = null; 
  Try ( 
  Pst = conn.prepareStatement (this.countSQL); 
  SetParams (pst); 
  Rs = pst.executeQuery (); 
  If (rs.next ()) ( 
  Rs.getInt totalCount = (1); 
  Else () 
  TotalCount = 0; 
  ) 

  Rs.close (); 
  Pst.close (); 

  If (totalCount <1) return RowSetPage.EMPTY_PAGE; 

  Pst = conn.prepareStatement (this.querySQL); 
  System.out.println (querySQL); 
  Pst.setFetchSize (this.pageSize); 
  SetParams (pst); 
  Rs = pst.executeQuery (); 
  / / Rs.setFetchSize (pageSize); 

  This.rowSet = populate (rs); 

  Rs.close (); 
  Rs = null; 
  Pst.close (); 
  Pst = null; 

  This.rowSetPage = new RowSetPage (this.rowSet, startIndex, totalCount, pageSize); 
  Return this.rowSetPage; 
  ) Catch (SQLException sqle) ( 
  / / System.out.println ( "executeQuery SQLException"); 
  Sqle.printStackTrace (); 
  Throw sqle; 
  ) Catch (Exception e) ( 
  E.printStackTrace (); 
  Throw new RuntimeException (e.toString ()); 
  Finally () 
  / / System.out.println ( "executeQuery finally"); 
  DBUtil.close (rs, pst, conn); 
  ) 
  ) 

  / ** 
  * ResultSet data will be filled into CachedRowSet 
  * / 
  Protected abstract RowSet populate (ResultSet rs) throws SQLException; 

  / ** 
  * Packaging from query results into RowSet 
  * @ Return RowSet 
  * / 
  Public javax.sql.RowSet getRowSet () ( 
  Return this.rowSet; 
  ) 


  / ** 
  * Packaging from the query results into RowSetPage 
  * @ Return RowSetPage 
  * / 
  Public RowSetPage getRowSetPage () ( 
  Return this.rowSetPage; 
  ) 

  / ** 
  * Close Database Connection 
  * / 
  Public void close () ( 
  / / Database connection because in the end enquiries or anomalies that closed here do nothing 
  / / Left to expand. 
  ) 

  (Private class BoundParam 
  Int index; 
  Object value; 
  Int sqlType; 
  Int scale; 

  Public BoundParam (int index, Object value) ( 
  This (index, value, java.sql.Types.OTHER); 
  ) 

  Public BoundParam (int index, Object value, int sqlType) ( 
  This (index, value, sqlType, 0); 
  ) 

  Public BoundParam (int index, Object value, int sqlType, int scale) ( 
  This.index = index; 
  This.value = value; 
  This.sqlType = sqlType; 
  This.scale = scale; 
  ) 

  Public boolean equals (Object obj) ( 
  If (obj! = Null & this.getClass (). IsInstance (obj)) ( 
  BoundParam bp = (BoundParam) obj; 
  If (this.index == bp.index) return true; 
  ) 
  Return false; 
  ) 
  ) 

  ) 


///////////////////////////////////
  / / 
  / / PagedStatementOracleImpl.java 
  / / Author: evan_zhao@hotmail.com 
  / / 
///////////////////////////////////
  Package page; 
  Import java.sql.ResultSet; 
  Import java.sql.SQLException; 
  Import javax.sql.RowSet; 
  Import oracle.jdbc.rowset.OracleCachedRowSet; 

  / ** 
*

  Title: tabbed for Oracle Database 


*

  Copyright: Copyright (c) 2002 


  * @ Author evan_zhao@hotmail.com 
  * @ Version 1.0 
  * / 
  Public class PagedStatementOracleImpl extends PagedStatement ( 

  / ** 
  * Constructors enquiries from all data PageStatement 
  * @ Param sql query sql 
  * / 
  Public PagedStatementOracleImpl (String sql) ( 
  Super (sql); 
  ) 


  / ** 
  * When a structure for a page of data PageStatement 
  * @ Param sql query sql 
  * @ Param pageNo page 
  * / 
  Public PagedStatementOracleImpl (String sql, int pageNo) ( 
  Super (sql, pageNo); 
  ) 

  / ** 
  * When a structure for a page PageStatement data, and specify the number of records per page 
  * @ Param sql query sql 
  * @ Param pageNo page 
  * @ Param pageSize page capacity 
  * / 
  Public PagedStatementOracleImpl (String sql, int pageNo, int pageSize) ( 
  Super (sql, pageNo, pageSize); 
  ) 


  / ** 
  * Generation for a data sql statement 
  * @ Param sql original query 
  * @ StartIndex begin recording location 
  * @ Size needed to get the record number 
  * / 
  Protected String intiQuerySQL (String sql, int startIndex, int size) ( 
  StringBuffer querySQL = new StringBuffer (); 
  If (size! = Super.MAX_PAGE_SIZE) ( 
  QuerySQL.append ( "select * from (select my_table .*, rownum as my_rownum from (") 
  . Append (sql) 
  . Append ( ") my_table where rownum <"). Append (startIndex + size) 
  . Append ( ") where my_rownum >="). append (startIndex); 
  Else () 
  QuerySQL.append ( "select * from (select my_table .*, rownum as my_rownum from (") 
  . Append (sql) 
  . Append ( ") my_table") 
  . Append ( ") where my_rownum >="). append (startIndex); 
  ) 
  Return querySQL.toString (); 
  ) 

  / ** 
  * ResultSet data will be filled into CachedRowSet 
  * / 
  Protected RowSet populate (ResultSet rs) throws SQLException ( 
  OracleCachedRowSet ocrs = new OracleCachedRowSet (); 
  Ocrs.populate (rs); 
  Return ocrs; 
  ) 

  ) 



  This paper quoted a circular Address: http://blog.csdn.net/wanchao2001/services/trackbacks/460066.aspx 
  Function TempSave (ElementID) (CommentsPersistDiv.setAttribute ( "CommentContent" document.getElementById (ElementID). Value); CommentsPersistDiv.save ( "CommentXMLStore");) function Restore (ElementID) (CommentsPersistDiv.load ( "CommentXMLStore"); document . getElementById (ElementID). CommentsPersistDiv.getAttribute value = ( "CommentContent");) </ td> </ tr> <tr> 

  ↑ Back 

Create directories in JSP

  Abstract: to create directories in JSP 

  </ Td> </ tr> <tr> <td width="540" height="35" valign="top" class="ArticleTeitle"> <% – 
  Author: Hua Lian [hlian@alleasy.net] 
  Date: 2000-07-20-10-10 
  Version: 1.0 
  Features: JSP routines - to create directories in JSP 
  Call: 
  Paper trails path 
  Mkdir (String path) 
  Back to: 
  Air operations for the successful return 
  Operation failed to return to the reasons for failure. 
  If there is the question to invite feedback to hlian@alleasy.net. 
–%>

  <% @ Page contentType = "text / html; gb2312 charset ="%> 

  <% @ Page import = "java.io. *"%> 
<%!
  String Mkdir (String path) ( 

  String msg = null; 
  Java.io.File dir; 

  / / Object new document 
  Dir = new java.io.File (path); 
  If (dir == null) ( 
  Msg = "wrong reasons: 
  Sorry, can not create space directory!  ";
  Return msg; 
  ) 
  If (dir.isFile ()) ( 
  Msg = "wrong reasons: 
  Have the same name document "+ dir.getAbsolutePath () +" there.  ";
  Return msg; 
  ) 

  If (! Dir.exists ()) ( 
  Boolean result = dir.mkdirs (); 
  If (result == false) ( 
  Msg = "wrong reasons: 
  Contents "+ dir.getAbsolutePath () +" failure to create, for unknown reasons!  ";
  Return msg; 
  ) 
  / / Create directories, if successful, no output. 
  Msg = "successfully created directory:" + dir.getAbsolutePath () + ""; 
  Return msg; 
  Else () 
  Msg = "wrong reasons: 
  Contents "+ dir.getAbsolutePath () +" already exists.  ";
  ) 
  Return msg; 
  ) 
%>
<%
  String filepath = "usr / home / hoyi / html / dir"; 
  String opmsg = Mkdir (filepath); 
  Out.println (opmsg); 
%>
  </ Td> <td width="173" valign="top" class="ArticleTeitle"> 
  </ Td> </ tr> <tr> <td height="25" colspan="2" valign="top" class="ArticleTeitle"> 

  ↑ Back 

JSP and interactive data JavaScirpt

  Abstract: JSP and interactive data JavaScirpt 

  </ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle"> <table width = "100%" border = "0" cellspacing = "0" cellpadding = " 0 "> <tr> <td width="277" height="86" align="center" valign="top"> </ td> <td width="407" valign="top"> 

  For WEB procedures, the front-end (JavaScript) and back-end (JSP / Servlet) is not shared data can only be a back-end process (JSP) to output data, generating pages to the front pages this time generation The JavaScript code may be only so-called jsp data.    Similarly, JavaScript, only to the data submitted to the backend JSP code, JSP process can be JavaScript data. 

  How to achieve it in the pages of the use of JavaScript in jsp data or jsp pages use the JavaScript data? 

  First, the JavaScript pages of data submitted to the background of how the procedures jsp 
  â‘  can JavaScript data to xxx.JSP? Var1 = aaa & var2 = bbb in the form of the parameters passed as a URL JSP procedures used at this time jsp 
  <% String strVar1 = request.getParameter ( "var1 ");%> can get to the JavaScript scripting transfer from the data; 

  â‘¡ form through the use of JavaScript added to hide domain information, and then use the form to the way the data transfer to the JSP procedures. 

  </ Td> </ tr> </ table> 

  Second, in the pages of JavaScript how to use the data behind the data JSP procedures 
  This relatively simple, and used directly in the JavaScript scripting <strVar1%% => jsp procedures will be in the data transfer to use the JavaScript scripting. 

  Third, reference to the following examples: 

  1, test.jsp 

  <% @ Page contentType = "text / html; gb2312 charset ="%> 

<%
  String s1 = "Hello"; 
  String s2 = "World!"; 
%>

  <script Language="JavaScript"> 
  /************************************************* The following 
  * JavaScript scripts, placed in the position of any of pages can be 
  * Insertclick () function to transfer access to JSP pages in the variable s1, 
  * JavaScript can then modify the value of this variable, and through the 
  * Post to the way JSP procedures to use. 
  ************************************************** *************/ 
  Function insertclick () ( 
  Var1 ="<%= s1%> "; 
  Document.forms [ "insertForm"]. Mc.value var1 = + document.forms [ "insertForm"]. Mc.value; 
  Document.insertForm.submit (); 
  ) 
  / / 
  </ Script> 

  <form Name="insertForm" method="post" action="get.jsp"> 
  <Input type = "hidden" name = "mc" value ="<%= s2%> "> 
  <input Type="button" value="提交" onclick="insertclick()"> 
  </ Form> 

  2, get.jsp 

<%
  String strVar1 = request.getParameter ( "mc"); 
  Out.print (strVar1); 
%>

  </ Td> </ tr> <tr> 

  ↑ Back 

Jsp Access Resource Kit

  Abstract: Access Resource Kit jsp 

  </ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle"> <table width="736" border="0"> <tr> <td width = " 730 "> </ td> </ tr> </ table> 

  Write a tool categories: 

  Package jsfdb.model; import java.util.ResourceBundle; import java.util.MissingResourceException; import java.util.logging.Level; import java.util.logging.Logger; public class ModelUtils (/ / attention to how to access resources attribute documents location 
  Public static final String RESOURCES = ModelUtils.class.getPackage (). GetName () +. "Res.ModelResources"; private static ResourceBundle resources; public static void log (Throwable x) (Logger.global.log (Level.SEVERE, x . getMessage (), x);) public static synchronized ResourceBundle getResources () (if (resources == null) (try ResourceBundle.getBundle resources = (RESOURCES);) catch (MissingResourceException x) (log (x); throw new InternalError (x.getMessage ());) return resources;) 
  Public static String getResource (String key) (return getResources (). GetString (key);)) 

  Calling in JSP: 

  <% @ Page contentType = "text / html; GBK charset ="%> 
  <% @ Page import = "java.util.Locale"%> 
  <% @ Page import = "jsfdb.model .*"%> 
<%
  String s2 = ModelUtils.getResource ( "indexWindowTitle"); 

  String s3 = ModelUtils.getResource ( "indexPageTitle"); 

  Out.println ( "window title =" + + s2 " 
");
  Out.println ( "page title =" + + s3 " 
");

  Out.println (ModelUtils.RESOURCES); 
%>

  The result: 

  Window Title = = JSF test page headline Please fill in the following information 
  Jsfdb.model.res.ModelResources 

  Attachment: ModelResources_zh_CN.properties 
  JSF indexWindowTitle = \ u6d4b \ u8bd5 
  IndexPageTitle = \ u8bf7 \ u586b \ u5199 \ u4e0b \ u5217 \ u7684 \ u4fe1 \ u606f 

  </ Td> </ tr> <tr> 

  ↑ Back 

Rm players and jsp

  Abstract: rm players and jsp 

  </ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle"> jsp page embedded with the rm format with players, players rm format images and music.    Function TempSave (ElementID) (CommentsPersistDiv.setAttribute ( "CommentContent" document.getElementById (ElementID). Value); CommentsPersistDiv.save ( "CommentXMLStore");) function Restore (ElementID) (CommentsPersistDiv.load ( "CommentXMLStore"); document . getElementById (ElementID). CommentsPersistDiv.getAttribute value = ( "CommentContent");) </ td> </ tr> <tr> 

  ↑ Back 

Jsp mapping 50 cases

  Abstract: Drawing 50 cases jsp 

  </ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle"> <table width = "100%" border = "0" cellspacing = "0" cellpadding = " 0 "> <tr> <td width="310" height="129" align="center" valign="top"> 1, text and line drawing JSP 
  2, and 3-D mapping Arc 
  3, drawing 3-D elliptic and Zhengyuan 
  4, drawing 3-D rectangular 1 
  5, drawing 3-D rectangular 2 
  6, drawing arc 
  7, cube mapping 
  8, drawing cylinder 
  9, and drawing elliptical Zhengyuan 
  10, rendering polygon 
  11, Broken Line Drawing 
  12, rectangular drawing 
  13, drawing triangle 
  14, the effect of rendering a variety of fonts 
  15, access to accurate information characters 
  16, access to custom triangle 
  17, vertical cubic map 
  18, Arc2D.Double Example 
  19, the Web-based Java2D charts Example: Figure circle 
  20, the use of the createTransformedShape 
  21, drawing three curves 
  22, the Web-based Java2D charts Example: Drawing hollow text 
  23, the use of generic path 
  24, the progressive-filled Java2D 

  25, the Web-based Java2D chart examples: Automatic Text Branch Show 
  26, and attribute mapping different sequence of overlapping graphic results 
  27, pears paintings, the Boolean operation examples Area 
  28,3 D Bingtu 
  29, ordinary Bingtu 
  30, drawing quadratic curve 
  31, the use of the Rectangle2D 
  32, after dealing with anti-aliased 3-D Bingtu 
  33, drawing bending text 
  34, graphical object rotation 
  35, graphical object scaling 
  36, graphical object distortions 
  37, display graphical object translation 
  38, transparent 3-D Bingtu 

  </ Td> <td width="95" align="center" valign="top"> Click for effect 
  Click for effect 
  Click for effect 
  Click for effect 
  Click for effect 
  Click for effect 
  Click for effect 
  Click for effect 
  Click for effect 
  Click for effect 
  Click for effect 
  Click for effect 
  Click for effect 
  Click for effect 
  Click for effect 
  Click for effect 
  Click for effect 
  Click for effect 
  Click for effect 
  Click for effect 
  Click for effect 
  Click for effect 
  Click for effect 
  Click for effect 

  Click for effect 
  Click for effect 
  Click for effect 
  Click for effect 
  Click for effect 
  Click for effect 
  Click for effect 
  Click for effect 
  Click for effect 
  Click for effect 
  Click for effect 
  Click for effect 
  Click for effect 
  Click for effect 

  </ Td> <td width="62" align="center" valign="top"> Show source 
  Show source 
  Show source 
  Show source 
  Show source 
  Show source 
  Show source 
  Show source 
  Show source 
  Show source 
  Show source 
  Show source 
  Show source 
  Show source 
  Show source 
  Show source 
  Show source 
  Show source 
  Show source 
  Show source 
  Show source 
  Show source 
  Show source 
  Show source 

  Show source 
  Show source 
  Show source 
  Show source 
  Show source 
  Show source 
  Show source 
  Show source 
  Show source 
  Show source 
  Show source 
  Show source 
  Show source 
  Show source 

  </ Td> <td width="217" valign="top"> 
  </ Td> </ tr> <tr> <td height="44" colspan="3"> 

  </ Td> <td height="44"> </ td> </ tr> </ table> 

  </ Td> </ tr> <tr> 

  ↑ Back 

Jsp in the use of SAX

  Abstract: In the use of SAX jsp 

  </ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle"> you will xerces.jar document Add to the application's WEB-INF/lib web directory, xml document preparation to deal with the processor as follows: 
  Package example; 
  Import java.io. *; 
  Import java.util.Hashtable; 
  Import org.xml.sax .*; 
  Import org.xml.sax.helpers .*; 

  Public class SAXHandler extends DefaultHandler 
  ( 
  Private Hashtable table = new Hashtable (); 
  Private String currentElement = null; 
  Private String currentValue = null; 

  Public void setTable (Hashtable table) 
  ( 
  This.table = table; 
  ) 

  Public Hashtable getTable () 
  ( 
  Return table; 
  ) 

  Public void startElement (String nspaceURI, String localName, String qName, Attributes atts) throws SAXException ( 
  / / System.out.println ( "Starting element:" + localName); 
  CurrentElement = localName; 
  ) 

  Public void characters (char [] ch, int start, int length) throws SAXException 
  ( 
  CurrentValue = new String (ch, start, length); 
  ) 

  Public void endElement (String namespaceURI, String localName, String qualifiedName) throws SAXException ( 
  / / System.out.println ( "Ending element:" + localName); 
  If (currentElement.equals (localName)) 

  Table.put (currentElement, currentValue); / / element name and content into a Hashtable 

  ) 

  ) 

  Jsp code with the following tests: 
  <% @ Page contentType = "text / html; GBK charset ="%> 


<head>

  </ Head> 
<body>
  <% @ Page import = "org.xml.sax .*"%> 
  <% @ Page import = "org.xml.sax.helpers.XMLReaderFactory"%> 
  <% @ Page import = "example.SAXHandler"%> 
  <% @ Page import = "java.util .*"%> 

  <% String fi = getServletContext (). GetRealPath ("/")+" dir1 \ \ dir6 \ \ ex.xml "; 
  XMLReader parser = XMLReaderFactory.createXMLReader ( "org.apache.xerces.parsers.SAXParser"); 
  SAXHandler handler = new SAXHandler (); 
  Parser.setContentHandler (handler); 
  Parser.parse (fi); 
  Hashtable hashTable = handler.getTable (); 
  Enumeration e = hashTable.keys (); 
  While (e.hasMoreElements ()) ( 
  String key = (String) e.nextElement (); 
  Out.println (key + ":" + hashTable.get (key) + " 
");
  ) 

%>
  <table Width="675" height="26" border="0"> <tr> <td width="357"> ex.xml document are as follows: 
  <? Xml version = "1.0" encoding = "GB2312" standalone = "no"> 
  Booklist [ 






]>



  <Title> playing OfficeXP 
  <Pricing> 580 yuan 
  <Reader mail exchanges> & QA-email; 

  </ Td> <td width="308"> </ td> </ tr> </ table> 
  Function TempSave (ElementID) (CommentsPersistDiv.setAttribute ( "CommentContent" document.getElementById (ElementID). Value); CommentsPersistDiv.save ( "CommentXMLStore");) function Restore (ElementID) (CommentsPersistDiv.load ( "CommentXMLStore"); document . getElementById (ElementID). CommentsPersistDiv.getAttribute value = ( "CommentContent");) </ td> </ tr> <tr> 

  ↑ Back 

Jsp read attribute server

  Abstract: jsp read attribute server 

  </ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle"> 
  <table Width="734" border="0"> <tr> <td width="728"> </ td> </ tr> </ table> 
  <% @ Page contentType = "text / html; gb2312 charset ="%> 
  <% @ Page import = "java.util .*"%> 

<head>



  </ Head> 

  <body Bgcolor="#FFFFFF" text="#000000" leftmargin="10" topmargin="10" marginwidth="0" marginheight="0"> 
  <table Width="80%" border="0" cellspacing="1" cellpadding="4"> 
<tr>
  <td Colspan="2" bgcolor="#8CC2E3"> JSP Info v1.0 </ td> 
  </ Tr> 
<tr>
  <td Colspan="2" bgcolor="#DEEEF8"> Author: Snowman Web: 

  Http://www.xinboard.net 
  </ Td> 
  </ Tr> 
  <tr Bgcolor="#FFFFFF"> 
  <td Colspan="2" height="50"> </ td> 
  </ Tr> 
  <tr Bgcolor="#B4D8ED"> 
  <td Width="30%"> Environment (Environment) </ td> 
  <td Width="70%"> Values (value) </ td> 
  </ Tr> 
  <tr Bgcolor="#DEEEF8"> 
  <td Bgcolor="#DEEEF8"> Server name (the name of the server) </ td> 
  <td> <% = Request.getServerName ()%> </ td> 
  </ Tr> 
  <tr Bgcolor="#DEEEF8"> 
  <td> Server port (server ports) </ td> 
  <td> <% = Request.getServerPort ()%> </ td> 
  </ Tr> 
  <tr Bgcolor="#DEEEF8"> 
  <td> Remote IP address (the client IP address) </ td> 
  <td> <% = Request.getRemoteAddr ()%> </ td> 
  </ Tr> 
  <tr Bgcolor="#DEEEF8"> 
  <td Colspan="2"> Context attributes (associated attributes) </ td> 
  </ Tr> 
<%
  ServletContext context = getServletContext (); 
  Enumeration enum = context.getAttributeNames (); 
  While (enum.hasMoreElements ()) ( 
  String key = (String) enum.nextElement (); 
  Object value = context.getAttribute (key); 
  Out.println ( "<tr bgcolor=#DEEEF8> <td>" + key + "</ td> <td>" + + value, "</ td> </ tr>"); 
  ) 

%>
  <tr Bgcolor="#FFFFFF" valign="bottom"> 
  <td Colspan="2" height="50"> End (concluded) </ td> 
  </ Tr> 
  </ Table> 
  </ Body> 
  </ Td> </ tr> <tr> 

  ↑ Back 

Jsp run by Japplet

  Abstract: jsp running Japplet 

  </ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle"> 
  <table Width="680" border="0"> <tr> <td width="397"> APPLET such as a web site can be written like this: 





  Then, in JSP can be replaced by: 







  Jsp: plugin there are many optional attributes, and elements similar APPLET.    Following is the list attributes: </ td> <td width="273"> </ td> </ tr> </ table> 
1.type
  For APPLET, value applet. 

  2.code specified types of documents 

3.width

4.height

5.codebase

6.align
  WEB page designated for the alignment of the apple way.    RMS: left right bottom middle 

7.hspace

8.vspace

9.archive
  Designate a JAR file, type and images from the document should be loaded. 

10.name
  Applet to designate a name for internal communications applet. 

11.title

12.jreversion
  Designation for the Java Runtime Environment (JRE) version 1.1 default values 

13.iepluginurl
  This attribute can be downloaded to a designated Internet Explorer plug-in the URL, not installed plug-in users will be prompted to download from this location. 
  Default values to the user instructions SUN site.    (Http://java.sun.com/products/plugin/) 

14.nspluginurl
  The designation of a property can be downloaded Netscape plug-in the URL, not installed plug-in users will be prompted to download from this location. 
  Default values to the user instructions SUN site. 
  Below are the test code: PluginApplet.jsp 
  <% @ Page contentType = "text / html; charset = GB2312"%> 

<head>

  <link> REL = STYLESHEET HREF = "JSP-Styles.css" TYPE = "text / css"> 
  </ Head> 

<body>
  <table BORDER=5 ALIGN="CENTER"> 
  <tr> <th CLASS="TITLE"> use jsp: plugin show JApplet 
  </ Table> 









  </ Body> 
  </ Td> </ tr> <tr> 

  ↑ Back 

Jsp Calendar

  Abstract: jsp Calendar 

  </ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle"> one can choose the month and year to view the calendar.    </ Td> </ tr> <tr> 

  ↑ Back 

keep looking »