rstogbk.java

来自「对一些文件的上传下载」· Java 代码 · 共 98 行

JAVA
98
字号
/**
 * @(#)RsToGbk.java
 *
 *
 * @author 
 * @version 1.00 2008/10/8
 *控制软件显示的javabean
 */
package download;
import java.sql.*;
public class RsToGbk {
	//分页控制子模块
	//ShowOnePage(ResultSet,页数,每页记录数)
	public String ShowOnePage(ResultSet rs,int Page,int PageSize)
	{
		String str="";
		for(int i=1;i<=(Page-1)*PageSize+1;i++){
			try{
				rs.next();
			}catch(Exception e){
			}
		}
		for(int iPage=1;iPage<=PageSize;iPage++){
			str+=RsToGbook(rs);
			try{
				if(!rs.next())break;
			}catch(Exception e){
			}
		}
		return str;
	}
	//显示单行记录子模块
	public String RsToGbook(ResultSet rs){
		String tt="";
		try{

			tt = "<hr color=blue width='95%"+"'>";
			tt = tt +"<center><table border=1 width='75%'>";
			tt = tt +"<tr><td bgcolor=lightgreen width='15%'>软件名称:</td><td><a href='openfile.jsp?id="+rs.getInt("id")+"'target='dispwin'>"+rs.getString("showname")+"</a></td>";
			tt = tt +"<td bgcolor=lightgreen width='14%'>星级评定:</td><td width='21%'><font color=#ff0000>"+rs.getString("hot")+"</font></td>";
			tt = tt +"<tr><td bgcolor=lightgreen width='15%'>点击次数:</td><td><font color=#ff0000><b>"+rs.getInt("hits")+"</b></font></td>";
			tt = tt +"<td bgcolor=lightgreen>加入时间:</td><td>"+rs.getDate("dateandtime").toString()+"</td></tr>";
			tt = tt +"<tr><td bgcolor=lightgreen width='15%'>软件介绍:</td>";
			String memo=rs.getString("softnote");
			tt = tt +"<td colspan=3>"+memo+"</td></tr>";
			tt = tt +"</table></center>";
			
		}catch(SQLException e){
		}
		return tt;
	}
	//系统维护之显示子模块
	public String Xtwh2(ResultSet rs){
		String tt="";
		int tmpid=0;
		try{
			tmpid=rs.getInt("id");
		}catch(SQLException e){
		}
		try{
			tt+="<hr color=blue width=95%>";
			tt+="<form name='myform' action='oper.jsp'>";
			tt+="<center><table border=1 width='75%'>";
			tt+="<tr><td bgcolor=lightgreen width='15%'>软件名称:</td><td><a href='openfile.jsp?id="+tmpid+"'target='newwin'>"+rs.getString("showname")+"</a></td>";
			tt+="<td bgcolor=lightgreen width='14%'>星级评定:</td><td width='21%'><font color=#ff0000>"+rs.getString("hot")+"</font></td>";
			tt+="<tr><td bgcolor=lightgreen width='15%'>点击次数:</td><td><font color=#ff0000><b>"+rs.getInt("hits")+"</b></font></td>";
			tt+="<td bgcolor=lightgreen>加入时间:</td><td>"+rs.getDate("dateandtime").toString()+"</td></tr>";
			tt+="<tr><td bgcolor=lightgreen width='15%'>软件介绍:</td>";
			String memo=rs.getString("softnote");
			tt+="<td colspan=3>"+memo+"</td></tr>";
			tt+="<tr><td align=center><input type=submit name=add"+tmpid+ " value=增加></td>";
			tt+="<td align=center><input type=submit name=cha"+tmpid+ " value=修改></td>";
			tt+="<td colspan=2 align=center><input type=submit name=del"+tmpid+ " value=删除></td></tr>";
			tt+="</table></center></form>";	
		}
		catch(SQLException e){
		}
		return tt;
	}
	public String Xtwh(ResultSet rs,int Page,int PageSize)
	{
		String str="";
		for(int i=1;i<=(Page-1)*PageSize+1;i++){
			try{
				rs.next();
			}catch(Exception e){
			}
		}
		for(int iPage=1;iPage<=PageSize;iPage++){
			str+=Xtwh2(rs);
			try{
				if(!rs.next())break;
			}catch(Exception e){
			}
		}
		return str;
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?