主题:请教一个简单的jsp+Sqlserver的问题
我在数据库中建了一个字段为bit型的fufee(付费),当查询时显示为1和0,我想让它在页面上显示为"未付"和"已付",应该怎么做,请高手指教,本人新手,望大家多多指点!
红色标记为所要显示的代码
具体的代码如下:
<td><div align="left"><b>维修单号</b></div></td>
<td><div align="left"><b>客户姓名</b></div></td>
<td width="78"><div align="left"><b>客户地址</b></div></td>
<td><div align="left"><b>客户电话</b></div></td>
<td ><div align="left"><b>报修原因</b></div></td>
<td width="78"><strong>维修员工号</strong></td>
<td width="78"><div align="center"><b>应付费用</b></div></td>
<td width="78"><div align="center"><b>[color=00FFFF][color=FF00FF][color=C0C0C0][color=FF0000][color=0000FF][color=008080][color=0000FF][color=FF0000][color=0000FF][color=008080][color=0000FF][color=FF0000]付费情况[/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color]</b></div></td>
</tr>
<%
int i;
int ipage=15; //分頁單位
int allpage; //總頁數
int pages; //接受的頁碼變數
int cpage=1; //當前頁
int spage; //開始頁
int allCol=0;
Vector v=null;
//資料庫連接聲明
String rmid;
String fsql="select * from report,list,feelist where report.overrp=1 and report.unrp=1 and report.rpid=list.rpid and report.rptype = feelist.rptype";
ResultSet frs=db.executeQuery(fsql);
//取總文章數
while(frs.next())
{
allCol = frs.getRow();
System.out.println(allCol);
}
//獲得總頁面數
allpage = (int)Math.ceil((allCol + ipage-1) / ipage);
//判斷參數pages是否空
if (request.getParameter("pages")==null) {
pages=1;
} else {
pages = new Integer(request.getParameter("pages")).intValue();
System.out.println(pages);
}
//判斷當前頁
if(pages > allpage || pages == 0)
{cpage = 1;}
else
{
cpage = pages;
}
//判斷起始頁
String sql = "select Top "+ipage+" report.rpid,report.rpcustomername,report.rpaddress,report.rptel,report.rpreason,list.rmid ,feelist.rpfee,report.fufee from report,list,feelist where report.rpid not in (select top "+(cpage-1)*ipage+" report.rpid from report,list,feelist where report.overrp=1 and report.unrp=1 and report.rpid=list.rpid and report.rptype=feelist.rptype order by list.rpid desc) and report.overrp=1 and report.unrp=1 and report.rpid=list.rpid and report.rptype=feelist.rptype order by list.rpid desc";
ResultSet rs = db.executeQuery(sql);
while (rs.next())
{
rpid=rs.getString("rpid");
rpcustomername=rs.getString("rpcustomername");
rpaddress=rs.getString("rpaddress");
rptel=rs.getString("rptel");
rpreason=rs.getString("rpreason");
rmid=rs.getString("rmid");
rpfee=rs.getString("rpfee");
fufee=rs.getString("fufee");
%>
<tr><td width="78"><%= rpid %></a></td>
<td width="78"><%= rpcustomername %></a></td>
<td width="78"><%= rpaddress %></a></td>
<td width="78"><%= rptel %></a></td>
<td><%= rpreason %></a> <div align="center"></div></td>
<td><div align="center"><%= rmid %></a></div></td>
<td><div align="center"><%= rpfee %></a></div></td>
[color=FF0000] <td><div align="center"><%=fufee%></a></div></td>[/color]
</tr>
红色标记为所要显示的代码
具体的代码如下:
<td><div align="left"><b>维修单号</b></div></td>
<td><div align="left"><b>客户姓名</b></div></td>
<td width="78"><div align="left"><b>客户地址</b></div></td>
<td><div align="left"><b>客户电话</b></div></td>
<td ><div align="left"><b>报修原因</b></div></td>
<td width="78"><strong>维修员工号</strong></td>
<td width="78"><div align="center"><b>应付费用</b></div></td>
<td width="78"><div align="center"><b>[color=00FFFF][color=FF00FF][color=C0C0C0][color=FF0000][color=0000FF][color=008080][color=0000FF][color=FF0000][color=0000FF][color=008080][color=0000FF][color=FF0000]付费情况[/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color][/color]</b></div></td>
</tr>
<%
int i;
int ipage=15; //分頁單位
int allpage; //總頁數
int pages; //接受的頁碼變數
int cpage=1; //當前頁
int spage; //開始頁
int allCol=0;
Vector v=null;
//資料庫連接聲明
String rmid;
String fsql="select * from report,list,feelist where report.overrp=1 and report.unrp=1 and report.rpid=list.rpid and report.rptype = feelist.rptype";
ResultSet frs=db.executeQuery(fsql);
//取總文章數
while(frs.next())
{
allCol = frs.getRow();
System.out.println(allCol);
}
//獲得總頁面數
allpage = (int)Math.ceil((allCol + ipage-1) / ipage);
//判斷參數pages是否空
if (request.getParameter("pages")==null) {
pages=1;
} else {
pages = new Integer(request.getParameter("pages")).intValue();
System.out.println(pages);
}
//判斷當前頁
if(pages > allpage || pages == 0)
{cpage = 1;}
else
{
cpage = pages;
}
//判斷起始頁
String sql = "select Top "+ipage+" report.rpid,report.rpcustomername,report.rpaddress,report.rptel,report.rpreason,list.rmid ,feelist.rpfee,report.fufee from report,list,feelist where report.rpid not in (select top "+(cpage-1)*ipage+" report.rpid from report,list,feelist where report.overrp=1 and report.unrp=1 and report.rpid=list.rpid and report.rptype=feelist.rptype order by list.rpid desc) and report.overrp=1 and report.unrp=1 and report.rpid=list.rpid and report.rptype=feelist.rptype order by list.rpid desc";
ResultSet rs = db.executeQuery(sql);
while (rs.next())
{
rpid=rs.getString("rpid");
rpcustomername=rs.getString("rpcustomername");
rpaddress=rs.getString("rpaddress");
rptel=rs.getString("rptel");
rpreason=rs.getString("rpreason");
rmid=rs.getString("rmid");
rpfee=rs.getString("rpfee");
fufee=rs.getString("fufee");
%>
<tr><td width="78"><%= rpid %></a></td>
<td width="78"><%= rpcustomername %></a></td>
<td width="78"><%= rpaddress %></a></td>
<td width="78"><%= rptel %></a></td>
<td><%= rpreason %></a> <div align="center"></div></td>
<td><div align="center"><%= rmid %></a></div></td>
<td><div align="center"><%= rpfee %></a></div></td>
[color=FF0000] <td><div align="center"><%=fufee%></a></div></td>[/color]
</tr>