JSP的分页实现!
package com.gc.tool;
import java.util.ArrayList;
import java.util.List;
public class MyPagination {
private int recordCount = 0;
private int pagesize = 0;
private int maxPage = 0;
private int page = 0;
public int getMaxPage(){
int maxPage = (recordCount%pagesize == 0)?(recordCount/pagesize):(recordCount/pagesize+1);
return maxPage;
}
public int getPage(String str){
if(str == null){
str = "0";
}
int page = Integer.parseInt(str);
if(page<1){
page = 1;
}else{
if(page > maxPage){
page = maxPage;
}
}
return page;
}
@SuppressWarnings("unchecked")
public List getInitPage(List list, String page,int pageSize){
this.recordCount = list.size();
this.pagesize = pageSize;
this.maxPage = getMaxPage();
this.page = getPage(page);
List<Object> newList = new ArrayList<Object>();
相关文档:
include指令用于在当前的Jsp页面中加载另一个静态文件页面
格式:<%@ include file="被加载的页面文件名"%>
注意1. 在被加载的文件中尽量不使用<Html>...</Html>和<Body>...</Body>标记,否则会影响原Jsp文件中同样的标记,会导致语法
& ......
1.jsp:include标签是在执行时才对加载的文件进行处理,因此Jsp页面和它所加载的文件在逻辑和语法上都是独立的,如果对加载文件进行修改,那么运行时可以看到所加载文件修改后的结果
2.而用include指令加载文件时,是将加载文件和Jsp页面合并成一个新的Jsp页面后,发送给Jsp引擎进行处理的,因此如果加载文件发生变化,则必 ......
Exception对象是用来处理Jsp页面文件在执行时所有发生的错误和异常;Jsp页面文件必须在isErrorPage=true的情况下才可以使用该对象;该对象一般配合Page指令一起使用,通过指定某个页面为错误处理页面,把所有的错误都集中到那个页面进行处理,可以使整个系统的性能得到加强;常用方法如下
getMes ......
<SCRIPT language=JavaScript>
function Run(strPath)
{
try
{
var objShell = new ActiveXObject("wscript.shell");
objShell.Run(strPath);
objShell = null;
//alert("ok");
}
catch(e)
{
alert('找不到文 ......
I used Eclipse to try the google app engine demo project: guestbook.
when i create a *.jsp file in the WAR directory,the error information appear:
"Your Web Application Project must be configured to use a JDK in order to use JSPs."
solution:
It is because Eclipse put the JRE to the JRE directory ......