锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
public class RegmobileAction extends Action {
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception
{
String url;
url = " +"&CPKeys:=626A737977&Itemid=124444"
+"&FeeNumber="+request.getParameter("phone")
+"&Feetype=2&CTtag="+request.getParameter("CTtag")
+"&backUrl=http://mms.0000.com.cn/mov/index.jsp"
+"&deliverurl=http://mms.0000.com.cn/mov/deliver.do";
ActionForward gotourl = new ActionForward(url);//url鍙互鏍規嵁涓嶅悓寰楁潯浠舵寚瀹氫笉鍚屽緱鍦板潃鍜屼笉鍚屽緱鍙傛暟
gotourl.setPath(url);
gotourl.setRedirect(true);
return gotourl;
}
]]>
鐢ㄨ繖涓懡浠よ漿鎹㈡垜瑙夊緱涓嶆柟渚?涓嶇煡鍒漢濡備綍 鍛靛懙
鏀歸〉闈?859_1錛堜笉鑳芥槸iso-8859-1錛夊彲浠ヤ笉鐢╪ative2ascii杞崲ApplicationResources.properties
鍙槸娌¢〉閮借鏀瑰晩8859_1涔熷緢楹葷儲
鎵浠ュ彧濂芥壘struts鏈韓鏉ヨВ鍐充簡鍛靛懙
*涓嶈繃榪欎釜鏂規硶鍙傚悎灝忓簲鐢紝涓嶉渶瑕佸鍥借璦鐨?
struts.jar
org.apache.struts.taglib.bean.MessageTag綾?/p>
鎵懼埌doStartTag()鏂規硶
閲岄潰鏈夎ResponseUtils.write(super.pageContext, message);
鍦ㄨ繖琛屼笂闈㈠姞涓婁竴鍙?濡備笅
聽聽聽聽聽聽聽 try
聽聽聽聽聽聽聽 {
聽聽聽聽聽聽聽聽聽聽聽 message = new String(message.getBytes("iso-8859-1"), "gb2312");
聽聽聽聽聽聽聽 }
聽聽聽聽聽聽聽 catch(Exception exception) { }
聽聽聽聽聽聽聽 ResponseUtils.write(super.pageContext, message);
榪欐牱灝監K浜?/p>
<%@ page contentType="text/html; charset=gb2312" language="java" %>
瑕佺敤gb2312
-----------------------------------------------------------------------------------------------------------------------------------
CREATE Proc p_show
@QueryStr varchar(8000), --琛ㄥ悕銆佽鍥懼悕銆佹煡璇㈣鍙?br />@PageSize int=10,聽聽 --姣忛〉鐨勫ぇ灝?琛屾暟)
@PageCurrent int=1,聽聽 --瑕佹樉紺虹殑欏?br />@FdShow varchar (8000)='', --瑕佹樉紺虹殑瀛楁鍒楄〃,濡傛灉鏌ヨ緇撴灉鏈夋爣璇嗗瓧孌?闇瑕佹寚瀹氭鍊?涓斾笉鍖呭惈鏍囪瘑瀛楁
@FdOrder nvarchar (3000)='' --鎺掑簭瀛楁鍒楄〃
as
declare @FdName nvarchar(550) --琛ㄤ腑鐨勪富閿垨琛ㄣ佷復鏃惰〃涓殑鏍囪瘑鍒楀悕
聽,@Id1 varchar(80),@Id2 varchar(80) --寮濮嬪拰緇撴潫鐨勮褰曞彿
聽,@Obj_ID int聽聽聽 --瀵硅薄ID
--琛ㄤ腑鏈夊鍚堜富閿殑澶勭悊
declare @strfd nvarchar(4000) --澶嶅悎涓婚敭鍒楄〃
聽,@strjoin varchar(8000) --榪炴帴瀛楁
聽,@strwhere nvarchar(4000) --鏌ヨ鏉′歡
select @Obj_ID=object_id(@QueryStr)
聽,@FdShow=case isnull(@FdShow,'') when '' then ' *' else ' '+@FdShow end
聽,@FdOrder=case isnull(@FdOrder,'') when '' then '' else ' order by '+@FdOrder end
聽,@QueryStr=case when @Obj_ID is not null then ' '+@QueryStr else ' ('+@QueryStr+') a' end
--濡傛灉鏄劇ず絎竴欏碉紝鍙互鐩存帴鐢╰op鏉ュ畬鎴?br />if @PageCurrent=1
begin
聽select @Id1=cast(@PageSize as varchar(50))
聽exec('select top '+@Id1+@FdShow+' from '+@QueryStr+@FdOrder)
聽return
end
--濡傛灉鏄〃,鍒欐鏌ヨ〃涓槸鍚︽湁鏍囪瘑鏇存垨涓婚敭
if @Obj_ID is not null and objectproperty(@Obj_ID,'IsTable')=1
begin
聽select @Id1=cast(@PageSize as varchar(50))
聽 ,@Id2=cast((@PageCurrent-1)*@PageSize as varchar(50))
聽select @FdName=name from syscolumns where id=@Obj_ID and status=0x80
聽if @@rowcount=0聽聽 --濡傛灉琛ㄤ腑鏃犳爣璇嗗垪,鍒欐鏌ヨ〃涓槸鍚︽湁涓婚敭
聽begin
聽 if not exists(select 1 from sysobjects where parent_obj=@Obj_ID and xtype='PK')
聽聽 goto lbusetemp聽 --濡傛灉琛ㄤ腑鏃犱富閿?鍒欑敤涓存椂琛ㄥ鐞?/p>
聽 select @FdName=name from syscolumns where id=@Obj_ID and colid in(
聽聽 select colid from sysindexkeys where @Obj_ID=id and indid in(
聽聽聽 select indid from sysindexes where @Obj_ID=id and name in(
聽聽聽聽 select name from sysobjects where xtype='PK' and parent_obj=@Obj_ID
聽聽 )))
聽 if @@rowcount>1聽 --媯鏌ヨ〃涓殑涓婚敭鏄惁涓哄鍚堜富閿?br />聽 begin
聽聽 select @strfd='',@strjoin='',@strwhere=''
聽聽 select @strfd=@strfd+',['+name+']'
聽聽聽 ,@strjoin=@strjoin+' and a.['+name+']=b.['+name+']'
聽聽聽 ,@strwhere=@strwhere+' and b.['+name+'] is null'
聽聽聽 from syscolumns where id=@Obj_ID and colid in(
聽聽聽 select colid from sysindexkeys where @Obj_ID=id and indid in(
聽聽聽聽 select indid from sysindexes where @Obj_ID=id and name in(
聽聽聽聽聽 select name from sysobjects where xtype='PK' and parent_obj=@Obj_ID
聽聽聽 )))
聽聽 select @strfd=substring(@strfd,2,2000)
聽聽聽 ,@strjoin=substring(@strjoin,5,4000)
聽聽聽 ,@strwhere=substring(@strwhere,5,4000)
聽聽 goto lbusepk
聽 end
聽end
end
else
聽goto lbusetemp
/*--浣跨敤鏍囪瘑鍒楁垨涓婚敭涓哄崟涓瀛楁鐨勫鐞嗘柟娉?-*/
lbuseidentity:
聽exec('select top '+@Id1+@FdShow+' from '+@QueryStr
聽 +' where '+@FdName+' not in(select top '
聽 +@Id2+''+@FdName+' from '+@QueryStr+@FdOrder
聽 +')'+@FdOrder
聽 )
聽return
/*--琛ㄤ腑鏈夊鍚堜富閿殑澶勭悊鏂規硶--*/
lbusepk:聽
聽exec('select '+@FdShow+' from(select top '+@Id1+' a.* from
聽 (select top 100 percent * from '+@QueryStr+@FdOrder+') a
聽 left join (select top '+@Id2+''+@strfd+'
聽 from '+@QueryStr+@FdOrder+') b on '+@strjoin+'
聽 where '+@strwhere+') a'
聽 )
聽return
/*--鐢ㄤ復鏃惰〃澶勭悊鐨勬柟娉?-*/
lbusetemp:聽
select @FdName='[ID_'+cast(newid() as varchar(80))+']'
聽,@Id1=cast(@PageSize*(@PageCurrent-1) as varchar(50))
聽,@Id2=cast(@PageSize*@PageCurrent-1 as varchar(50))
exec('select '+@FdName+'=identity(int,0,1),'+@FdShow+'
聽 into #tb from'+@QueryStr+@FdOrder+'
聽select '+@FdShow+' from #tb where '+@FdName+' between '
聽+@Id1+' and '+@Id2
聽)
GO
--------------------------------------------------------------------------------------------------------------------------------
榪欓噷闇瑕佸緩绔嬩竴涓垎欏電被ResultGatherPro.java
鐩稿叧璇存槑鍦ㄧ浉搴旇鐨勫悗闈?br />
--------------------------------------------------------------------------------------------------------------------------------
import conn.DBConnManager;//榪欎釜鏄繛鎺ユ睜錛屽彲浠ユ洿鎹㈠叾浠栫殑銆?/p>
import javax.servlet.http.HttpServletRequest;
import java.sql.*;
import java.util.*;
public class ResultGatherPro {
聽聽聽 private String sql;
聽聽聽 private int intPageSize; //姣忛〉琛屾暟
聽聽聽 private int intRowCount;
聽聽聽 private int intPageCount;
聽聽聽 private int intPage; //欏靛彿
聽聽聽 private String Counter;
聽聽聽 DBConnManager conn = null;
聽聽聽 Connection con = null;
聽聽聽 CallableStatement stmt = null;
聽聽聽 ResultSet rs = null;
聽聽聽 Statement st = null;
聽聽聽 ResultSet rsc = null;
聽聽聽 private String defaultname = "default";
聽聽聽 public ResultGatherPro() {
聽聽聽 }
聽聽聽 public ResultGatherPro(String sqlcom, int rownum, int pagenum, String counter) {
聽聽聽聽聽聽聽 System.out.println(counter);
聽聽聽聽聽聽聽 sql = sqlcom;
聽聽聽聽聽聽聽 intPageSize = rownum;
聽聽聽聽聽聽聽 intPage = pagenum;
聽聽聽聽聽聽聽 Counter = counter;
聽聽聽聽聽聽聽 System.out.println(sqlcom);
聽聽聽 }
聽聽聽 public void setUseDB(String dbname)
聽聽聽 {
聽聽聽聽聽聽聽 this.defaultname = dbname;
聽聽聽 }
聽聽聽 public List selectRS(String sqlcom, int rownum, int pagenum, String counter) {
聽聽聽聽聽聽聽 System.out.println(counter);
聽聽聽聽聽聽聽 this.sql = sqlcom;
聽聽聽聽聽聽聽 this.intPageSize = rownum;
聽聽聽聽聽聽聽 this.intPage = pagenum;
聽聽聽聽聽聽聽 this.Counter = counter;
聽聽聽聽聽聽聽 System.out.println(sqlcom);
聽聽聽聽聽聽聽 return selectRS();
聽聽聽 }
聽聽聽 public List selectRS() {
聽聽聽聽聽聽聽 List rsall = new ArrayList();
聽聽聽聽聽聽聽 Map rsTree;
聽聽聽聽聽聽聽 try {
聽聽聽聽聽聽聽聽聽聽聽 conn = DBConnManager.getInstance();
聽聽聽聽聽聽聽聽聽聽聽 con = conn.getConnection(defaultname);
聽聽聽聽聽聽聽聽聽聽聽 st = con.createStatement();
聽聽聽聽聽聽聽聽聽聽聽 rsc = st.executeQuery(Counter);
聽聽聽聽聽聽聽聽聽聽聽 while (rsc.next()) {
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 intRowCount = rsc.getInt("allrow");
聽聽聽聽聽聽聽聽聽聽聽 }
聽聽聽聽聽聽聽聽聽聽聽 stmt = con.prepareCall("{call p_show('" + sql + "'," + intPageSize + "," + intPage + ")}");//濡傛灉鐢ㄥ埆鐨勬暟鎹簱灝辨妸榪欎釜鍦版柟淇敼涓涓?br />聽聽聽聽聽聽聽聽聽聽聽 rs = stmt.executeQuery();
聽聽聽聽聽聽聽聽聽聽聽 ResultSetMetaData rsmd = rs.getMetaData();
聽聽聽聽聽聽聽聽聽聽聽 int numberOfColumns = rsmd.getColumnCount();
聽聽聽聽聽聽聽聽聽聽聽 //Object[] aa = new Object[numberOfColumns-1];
聽聽聽聽聽聽聽聽聽聽聽 intPageCount = (intRowCount + intPageSize - 1) / intPageSize;
聽聽聽聽聽聽聽聽聽聽聽 while (rs.next()) {
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 rsTree = new HashMap(numberOfColumns);
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 for (int r = 1; r < numberOfColumns + 1; r++) {
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 rsTree.put(rsmd.getColumnName(r).toLowerCase(), rs.getObject(r));//toLowerCase()榪欎釜鍦版柟鎶婂垪鍚嶈漿鍖栦負灝忓啓鏄負浜嗗拰oracle鍏煎
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 }
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 rsall.add(rsTree);
聽聽聽聽聽聽聽聽聽聽聽 }
聽聽聽聽聽聽聽 } catch (java.lang.Exception ex) {
聽聽聽聽聽聽聽聽聽聽聽 System.out.println("db conn has a Exception !!!!");
聽聽聽聽聽聽聽聽聽聽聽 if(ex.toString().indexOf("peer")>0||ex.toString().indexOf("reset")>0)聽//涓鑸繛鎺ユ睜閮芥病鏈夎嚜鍔ㄩ噸榪炲姛鑳斤紝榪欓噷鏄綋鏁版嵁搴撹繛鎺ュ紓甯稿悗錛岃繘琛岄噸鏂板垵濮嬪寲榪炴帴銆備笉鐒跺嵆浣跨綉緇滄甯鎬簡錛屾暟鎹簱榪炴帴涔熶笉浼氭仮澶?br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 DBConnManager.reConnect();
聽聽聽聽聽聽聽聽聽聽聽 ex.printStackTrace();
聽聽聽聽聽聽聽 } finally {
聽聽聽聽聽聽聽聽聽聽聽 try {
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 if (rsc != null)
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 rsc.close();
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 if (st != null)
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 st.close();
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 if (rs != null)
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 rs.close();
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 if (stmt != null)
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 stmt.close();
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 if (conn != null)
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 conn.releaseConnection(defaultname, con);
聽聽聽聽聽聽聽聽聽聽聽 } catch (Exception e) {
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 System.out.println(e);
聽聽聽聽聽聽聽聽聽聽聽 }
聽聽聽聽聽聽聽 }
聽聽聽聽聽聽聽 return rsall;
聽聽聽 }
聽聽聽 public String ChangePage(HttpServletRequest request) {
聽聽聽聽聽聽聽 String urlchange = null;
聽聽聽聽聽聽聽 String pagename = request.getRequestURI().substring(request.getRequestURI().lastIndexOf("/") + 1);
聽聽聽聽聽聽聽 String url = getUrl(request);
聽聽聽聽聽聽聽 String dol = "";
聽聽聽聽聽聽聽 if (url != null && !url.equals(""))
聽聽聽聽聽聽聽聽聽聽聽 dol = "&";
聽聽聽聽聽聽聽 if (intPage > 1 && intPage < intPageCount) {
聽聽聽聽聽聽聽聽聽聽聽 urlchange = "<a href=" + pagename + "?pagenum=" + (intPage - 1) + dol + url + ">涓婁竴欏?lt;/a> | <a href=" + pagename + "?pagenum=" + (intPage + 1) + dol + url + ">涓嬩竴欏?lt;/a> | 絎? + intPage + "欏?| 鍏? + intPageCount + "欏?| 鍏? + intRowCount + "鏉?;
聽聽聽聽聽聽聽 } else if (intPage == 1 && intRowCount <= intPageSize) {
聽聽聽聽聽聽聽聽聽聽聽 urlchange = "涓婁竴欏?| 涓嬩竴欏?| 絎? + intPage + "欏?| 鍏? + intPageCount + "欏?| 鍏? + intRowCount + "鏉?;
聽聽聽聽聽聽聽 } else if (intPage == intPageCount && intPage != 1) {
聽聽聽聽聽聽聽聽聽聽聽 urlchange = "<a href=" + pagename + "?pagenum=" + (intPage - 1) + dol + url + ">涓婁竴欏?lt;/a> 涓嬩竴欏?| 絎? + intPage + "欏?| 鍏? + intPageCount + "欏?| 鍏? + intRowCount + "鏉?;
聽聽聽聽聽聽聽 } else if (intPage == 1 && intRowCount >= intPageSize) {
聽聽聽聽聽聽聽聽聽聽聽 urlchange = "涓婁竴欏?| <a href=" + pagename + "?pagenum=" + (intPage + 1) + dol + url + ">涓嬩竴欏?lt;/a> | 絎? + intPage + "欏?| 鍏? + intPageCount + "欏?| 鍏? + intRowCount + "鏉?;
聽聽聽聽聽聽聽 } else {
聽聽聽聽聽聽聽聽聽聽聽 urlchange = "<a href=" + pagename + ">絎竴欏?lt;/a>";
聽聽聽聽聽聽聽 }
聽聽聽聽聽聽聽 return urlchange;
聽聽聽 }
聽聽聽 public String ChangeBar(HttpServletRequest request) {
聽聽聽聽聽聽聽 String urlchange = null;
聽聽聽聽聽聽聽 String pagename = request.getRequestURI().substring(request.getRequestURI().lastIndexOf("/") + 1);
聽聽聽聽聽聽聽 String url = getUrl(request);
聽聽聽聽聽聽聽 String dol = "";
聽聽聽聽聽聽聽 if (url != null && !url.equals(""))
聽聽聽聽聽聽聽聽聽聽聽 dol = "&";
聽聽聽聽聽聽聽 if (intPage > 1 && intPage < intPageCount) {
聽聽聽聽聽聽聽聽聽聽聽 urlchange = "<a href=" + pagename + "?pagenum=" + (intPage - 1) + dol + url + ">涓婁竴欏?lt;/a> | <a href=" + pagename + "?pagenum=" + (intPage + 1) + dol + url + ">涓嬩竴欏?lt;/a> | 絎? + intPage + "欏?| 鍏? + intPageCount + "欏?;
聽聽聽聽聽聽聽 } else if (intPage == 1 && intRowCount <= intPageSize) {
聽聽聽聽聽聽聽聽聽聽聽 urlchange = "涓婁竴欏?| 涓嬩竴欏?| 絎? + intPage + "欏?| 鍏? + intPageCount + "欏?;
聽聽聽聽聽聽聽 } else if (intPage == intPageCount && intPage != 1) {
聽聽聽聽聽聽聽聽聽聽聽 urlchange = "<a href=" + pagename + "?pagenum=" + (intPage - 1) + dol + url + ">涓婁竴欏?lt;/a> 涓嬩竴欏?| 絎? + intPage + "欏?| 鍏? + intPageCount + "欏?;
聽聽聽聽聽聽聽 } else if (intPage == 1 && intRowCount >= intPageSize) {
聽聽聽聽聽聽聽聽聽聽聽 urlchange = "涓婁竴欏?| <a href=" + pagename + "?pagenum=" + (intPage + 1) + dol + url + ">涓嬩竴欏?lt;/a> | 絎? + intPage + "欏?| 鍏? + intPageCount + "欏?;
聽聽聽聽聽聽聽 } else {
聽聽聽聽聽聽聽聽聽聽聽 urlchange = "<a href=" + pagename + ">絎竴欏?lt;/a>";
聽聽聽聽聽聽聽 }
聽聽聽聽聽聽聽 return urlchange;
聽聽聽 }
聽聽聽 public int getTotal() {
聽聽聽聽聽聽聽 return intRowCount;
聽聽聽 }
聽聽聽 public int getPageCount() {
聽聽聽聽聽聽聽 return intPageCount;
聽聽聽 }
聽聽聽 public String gotoPage(HttpServletRequest request) {
聽聽聽聽聽聽聽 String url = getUrl(request);
聽聽聽聽聽聽聽 String javascript = "<script>function checksearch(sform)\n{if(sform.pagenum.value==\"\" || sform.pagenum.value==\"0\"){alert('璇瘋緭姝g‘鍏ラ〉鏁幫紒');sform.pagenum.focus();return false;}\nif(isNaN(sform.pagenum.value)){alert('璇瘋緭鍏ユ暟瀛楋紒');sform.pagenum.focus();return false;}}</script>";
聽聽聽聽聽聽聽 String form = "<table聽 border='0' cellpadding='0' cellspacing='0'>\n" + javascript;
聽聽聽聽聽聽聽 form += "<form聽聽 action='' onSubmit='return checksearch(this)'>\n<tr><td width='40' align='center'>\n<input name='pagenum' type='text' size='3' class='gotext'>\n ";
聽聽聽聽聽聽聽 if (url != null) {
聽聽聽聽聽聽聽聽聽聽聽 if (url.indexOf("&") > 0) {
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 String[] param = new String[(url.split("&")).length];
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 param = url.split("&");
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 for (int i = 0; i < param.length; i++) {
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 form += "<input type='hidden' name='" + param[i].substring(0, param[i].indexOf("=")) + "' value='" + param[i].substring(param[i].indexOf("=") + 1) + "'>\n";
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 }
聽聽聽聽聽聽聽聽聽聽聽 } else {
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 if (url.indexOf("=") > 0) {
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 form += "<input type='hidden' name='" + url.substring(0, url.indexOf("=")) + "' value='" + url.substring(url.indexOf("=") + 1) + "'>\n";
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 }
聽聽聽聽聽聽聽聽聽聽聽 }
聽聽聽聽聽聽聽 }
聽聽聽聽聽聽聽 form += "</td><td width='25' align='center'><input type='submit' name='Submit' value='GO' class='gobtn'>\n</td>\n</tr>\n</form>\n</table>";
聽聽聽聽聽聽聽 return form;
聽聽聽 }
聽聽聽 private String getUrl(HttpServletRequest request) {
聽聽聽聽聽聽聽 String url = "";
聽聽聽聽聽聽聽 Enumeration param = request.getParameterNames();
聽聽聽聽聽聽聽 while (param.hasMoreElements()) {
聽聽聽聽聽聽聽聽聽聽聽 String pname = param.nextElement().toString();
聽聽聽聽聽聽聽聽聽聽聽 if (!pname.equalsIgnoreCase("pagenum") && !pname.equalsIgnoreCase("submit"))
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 url += pname + "=" + request.getParameter(pname) + "&";
聽聽聽聽聽聽聽 }
聽聽聽聽聽聽聽 if (url.endsWith("&")) {
聽聽聽聽聽聽聽聽聽聽聽 url = url.substring(0, url.lastIndexOf("&"));
聽聽聽聽聽聽聽 }
聽聽聽聽聽聽聽 return url;
聽聽聽 }
聽聽聽 public String intercept(String str, int num, String last) {
聽聽聽聽聽聽聽 if (str.length() <= num)
聽聽聽聽聽聽聽聽聽聽聽 return str;
聽聽聽聽聽聽聽 else
聽聽聽聽聽聽聽聽聽聽聽 return str.substring(0, num) + last;
聽聽聽 }
}
--------------------------------------------------------------------------------------------------------
鍦╝ction閲屽彲浠ヨ繖鏍瘋皟鐢?br />鍙互鐪嬪埌action閲屾病鏈夊仛瀵逛紶閫掑弬鏁扮殑澶勭悊錛屽彧闇瑕佹妸request鏁翠釜浼犲埌鍒嗛〉綾婚噷灝卞彲浠ヤ簡
--------------------------------------------------------------------------------------------------------------
聽聽聽String sql = "select top 100 percent * from usertable";
聽聽聽String sqlcount = "select count(*) from usertable";//涓轟簡寰楀埌鎬昏鏁?br />聽聽聽int pagesize= 18;
聽聽聽int pagenum = 1;
聽聽聽if(request.getParameter("pagenum")!=null)
聽聽聽{
聽聽聽聽pagenum = java.lang.Integer.parseInt(request.getParameter("pagenum"));
聽聽聽}
聽聽聽ResultGatherPro rs = new ResultGatherPro(sql,pagesize,pagenum,sqlcount);
聽聽聽request.setAttribute("liststill",rs.selectRS());
聽聽聽request.setAttribute("changepage",rs.ChangePage(request));
聽聽聽request.setAttribute("gotopage",rs.gotoPage(request));
-----------------------------------------------------------------------------------------------------------------------------------
鏈鍚?jsp閲屽彲浠ヨ繖鏍峰啓
-------------------------------------------------------------------------------------------------------------------------
<logic:iterate id="listuser" name="liststill" type="Map">
<bean:write name='listuser' property='username'/>聽聽聽
<bean:write name='listuser' property='useremail'/>聽聽聽聽聽聽
</logic:iterate>
<bean:write name='changepage' filter="false"/>聽
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 <bean:write name='gotopage' filter="false"/>
涓婇潰涓や釜涓瀹氳璁劇疆filter="false" 涓嶇劧浼氳繃婊tml閮ㄥ垎
濡傛灉鐢╩ysql鏁版嵁搴?br />灝嗗垎欏電被涓?br />con.prepareCall("{call p_show('" + sql + "'," + intPageSize + "," + intPage + ")}");
鏀規垚
con.prepareCall(sql+" limit "+(intPage-1)*intPageSize+","+intPageSize);
濡傛灉鐢╫racle鏁版嵁搴?br />鏀規垚
con.prepareCall("SELECT * FROM(SELECT A.*, rownum r FROM("+sql+") A WHERE rownum <= "+intPage*intPageSize+") B WHERE r > "+(intPage-1)
*intPageSize);
鏈濂戒笉瑕佺敤鎶婃墍鏈夎褰曢兘璇誨嚭鏉ョ劧鍚庡湪鍏朵腑榪涜鍒嗛〉鐨勬柟娉?/p>