enctype="multipart/form-data"
jsp的enctype="multipart/form-data"怎么实现form表单的数据上传?请详细点 我都找了好几天了 就是没有答案 有的 还是模模糊糊的有谁可以给个例子看看 里面的smartupload怎么用啊 ?谢谢了 254477784@163.com
[解决办法]
推荐apache的common-upload,上传数据库和放到制定文件任选,而且都有简单样例代码。
至于分页,给你一个简单的分页代码吧(效能不高,需要优化):
具体分页类:
import java.util.*;public class Pager { private String PageUrl; private boolean hasNext; private boolean hasPrevious; private String previousPage; private String nextPage; private int offset; private int size; private int length; private int pagenumber; public Pager(int offset,int length, int size, String url){ this.offset=offset; this.length=length; this.size=size; int index=url.indexOf("&pager.offset"); if (index>-1){ this.PageUrl=url.substring(0,index); }else{ this.PageUrl=url; } } public void setoffset(int offset){ this.offset=offset; } public void setPagerUrl(String PagerUrl){ this.PageUrl=PagerUrl; } public void setsize(int size){ this.size=size; } public void setlength(int length){ this.length=length; } public int getoffset(){ return this.offset; } public String getPageUrl(){ return this.PageUrl; } public boolean gethasNext(){ if((offset+1)*length>=size){ hasNext=false; }else{ hasNext=true; } return hasNext; } public boolean gethasPrevious(){ if(offset>=1){ this.hasPrevious=true; }else{ this.hasPrevious=false; } return hasPrevious; } public String getpreviousPage(){ this.previousPage=""; if (this.gethasPrevious()){ this.previousPage=this.PageUrl+"&pager.offset="+(offset-1); } return previousPage; } public String getnextPage(){ this.nextPage=""; if(this.gethasNext()){ this.nextPage=this.PageUrl+"&pager.offset="+(offset+1); } return this.nextPage; } public int getpagenumber(){ float temppn=(float)size/(float)length; pagenumber=new Float(temppn).intValue(); if (temppn>pagenumber){ this.pagenumber++; } return this.pagenumber; } public static ArrayList FindPageList(int offset,int length,List list){ ArrayList alist=new ArrayList(); for(int i=offset*length; i<(offset*length+length)&&i<list.size();i++){ alist.add(list.get(i)); } return alist; } }