| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 549 人关注过本帖
标题:一个关于的问题
只看楼主 加入收藏
liqiang01
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2006-3-21
收藏
 问题点数:0 回复次数:1 
一个关于的问题
  请教各位高手一个问题,就是本人想生成一个TABLE,行和列分别为9,但要从数据库中取数据并插入到TABLE,而且预先不知道具体要插入到哪一行,哪一列,而是要通过数据库中的数据进行判断!请各为高手解决小弟这个问题,小弟在此先谢谢各位了!
搜索更多相关主题的帖子: 数据库 而且 
2006-03-21 15:04
gameovercn
Rank: 1
等 级:新手上路
帖 子:62
专家分:0
注 册:2005-10-25
收藏
得分:0 

<%
//以下代码实现分页
int recCount = 0; //当前记录数
int rowCount; //行总数
int pageCount; //页总数
int displayRecs = page_displayrecs; //每页显示的行数
int intPage=1; //当前页码
int intPage1; //最后一页
if(request.getParameter("start")==null)
{
intPage=1;
intPage1=1;
}
else
{
sql=request.getParameter("sql");
intPage=Integer.parseInt((String)request.getParameter("start"));
intPage1=intPage;

}
%>
<% //out.print(sql);

String ss3="";
String ss4="";
String ss5="";
String ygxdm="";//原关系代码,
String gxdm;//截取后可查询到所信息
String qypcs;//所
String lsgxdm;
//调用javabean.MDsjkczBean计算分页,查询显示数据
//out.println("sql:"+sql);
//if(true)return;
LinkedList ll=MDsjkczBean.MDllsnqcry(sql,displayRecs,intPage);
//利用LinkedList类存储所查询到的结果集,其中第一项为所查经果的总行数,第二项为所查结果的总页数
rowCount=Integer.parseInt((String)ll.get(0));
pageCount=Integer.parseInt((String)ll.get(1));
if(rowCount==0 || pageCount==0)
{
response.sendRedirect("TS_nors.jsp");
return;
}
String[] ss=null;
int size=ll.size();
if(ll.size()>2){ //if<F>

%>
<table width="<%=tablewidth%>"align="center" cellpadding="0" cellspacing="0" class="tablebig">
<tr>
<td align="center">
<table width="101%" border="0" cellpadding="0" cellspacing="0">
<tr class="notprint">
<td align="center" background="image/m_writer.gif"><table width="400" border="0" align="left" cellpadding="0" cellspacing="0">
<tr background="image/m_writer.gif">
<td width="50" align="center"><img src="image/m_writel.gif" width="50" height="25"></td>
<td width="664" align="left" background="image/m_writer.gif"><font class="title"></font></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2"><table width="100%" border="0" align="left" cellpadding="0" cellspacing="1">
<tr>
<th width="4%" align="center">序号</th>
<th width="7%" align="center">姓名</th>
<th width="2%" align="center">性别</th>
<th width="10%" align="center">出生日期</th>
<th width="16%" align="center">住址</th>
<th width="8%" align="center">号</th>
<th width="12%" align="center">时间</th>
<th width="10%" align="center">所</th>
<th width="10%" align="center">号</th>
<th width="10%" align="center">情况</th>
<th width="7%" align="center">户</th>
<input type="hidden" name="h_dyzc" value="@序号@姓名@性别@出生日期@住址@号@时间@所@号@情况@户">
</tr>
<tr class="tr3">
<td height="1" colspan="11"></td>
</tr>

<%

//循环显示数据
for(int j=2;j<size;j++)
{//for<1>
ss=(String[])ll.get(j);
if(ss[3]!=null){ss3=(MDzdBean.MDzdzh(application.getAttribute("A_JLX"),ss[3])).trim();}else{ss3="";}//将换为汉字
if(ss[4]!=null){ss4=ss[4].trim();}else{ss4="";}
if(ss[5]!=null){ss5=ss[5].trim();}else{ss5="";}
if(ss[15]!=null){ygxdm=ss[15].trim();}else{ygxdm="";}
if(ss[16]!=null){lsgxdm=ss[16].trim();}else{lsgxdm="";}
lsgxdm=lsgxdm.substring(0,6);
gxdm=ygxdm.substring(0,4)+ygxdm.substring(6,11);
qypcs=MDzdBean.MDzdzh(application.getAttribute("A_PCS"),gxdm);
String ys="";
if(j%2==0)ys="tr1";else ys="tr2";
%>
<tr class=<%=ys%> onMouseOver="this.className='trfocus'" onMouseOut="this.className='<%=ys%>'">
<td align="center"><%=(displayRecs*(intPage - 1) + (j-1))%></td>
<td align="center" style="font-family:方正宋体-信息" nowrap><div align="left"><a href="javascript:showxxxx('MDxxxx.jsp?PID=<%=ss[9]%>','信息')" title="信息"><%=ss[0]==null||ss[0].length()==0?"":ss[0]%></a></div></td>
<%
String str_xb="";
if(ss[1].equals("1"))
str_xb="男";
else
str_xb = "女";
%>
<td align="center" nowrap><%=ss[1]==null||ss[1].length()==0?"":str_xb%></td>

<td align="center" nowrap><div align="center"><%=ss[2]==null||ss[2].length()==0?"":MDrqBean.MDrqzh8(ss[2])%></div></td>

<td align="center" nowrap><div align="left"><a href="javascript:showxxxx('MDmlpxx.jsp?PID=<%=ss[12]%>','信息')" title="信息"><%=(ss3+ss4+ss5)%></a></div></td>

<td align="center" nowrap><a href="javascript:showxxxx('MDxshcyxx.jsp?PID=<%=ss[6]%>','信息')" title="信息" ><%=ss[6]==null?"":ss[6]%></a></td>

<td align="left" nowrap><div align="center"><%=ss[7]==null||ss[7].length()==0?"":MDrqBean.MDrqzh14(ss[7])%></div></td>

<td align="left" nowrap><div align="center"><a href="javascript:showxxxx('MDdyqyz_llqc.jsp?PID=<%=ss[13]%>&PIDD=1','迁')" title="打印" ><%=qypcs%></a></div></td>

<td align="left" nowrap><a href="javascript:showxxxx('MAzzbdxxjxcx_xxxx.jsp?PID=<%=ss[9]%>&slsj=<%=ss[7]%>&xzz_dzwym=<%=ss[14]%>','息')" title="地"><%if(ss[10]!=null && !ss[10].equals("")){out.print("全户迁出");}else{if(ss[11].equals("02")){out.print("个");}else{out.print("个");}}%></a>

<%
String hz = "";
LinkedList ll_hz=MDsjkczBean.MDcx("select xm from rkjbxx where hh='"+ss[6]+"' and (yhzgx='02' or yhzgx='03') and (jlzt='0' or jlzt='2' )");
// out.println("<p>"+"select xm from rkjbxx where hh='"+ss[6]+"' and (jtgx='02' or jtgx='03') and (jlzt='0' or jlzt='2' )"+"<p>");
if(ll_hz!=null&&ll_hz.size()>0){
String temp_hz [] = (String [])ll_hz.get(0);
if(temp_hz!=null&&temp_hz.length>0&&temp_hz[0]!=null){
hz=temp_hz[0];
}
}
if(hz==null)hz="";
%>
<%

if(ss[1].equals("1"))
ss[1]="男";
else
ss[1] = "女";
%>
<td align="center"><%=ss[8]==null||ss[8].length()==0?"":ss[8]%></td>
<td align="center"><%=hz%></td>
<input type="hidden" name="h_dyzc" value="@<%=(displayRecs*(intPage - 1) + (j-1))%>@<%=ss[0]==null||ss[0].length()==0?"":ss[0]%>@<%=ss[1]==null||ss[1].length()==0?"":ss[1]%>@<%=ss[2]==null||ss[2].length()==0?"":MDrqBean.MDrqzh8(ss[2])%>@<%=(ss3+ss4+ss5)%>@<%=ss[6]==null?"":ss[6]%>@<%=ss[7]==null||ss[7].length()==0?"":MDrqBean.MDrqzh14(ss[7])%>@<%=ss[8]==null?"":ss[8]%>@<%if(ss[10]!=null && !ss[10].equals("")){out.print("全");}else{if(ss[11].equals("02")){out.print("个)");}else{out.print("个");}}%>@<%=hz%>"></td>

</tr>
<%
}//end for<1>
}//end if<F>
%>

一个大体的结构吧,方法比较老,但是是我现在项目的真实一段,看看吧,希望有帮助。


中国!!!你别玩了!!! 我昨天做梦了,我成了个框架师,哈哈
2006-03-21 16:01
快速回复:一个关于的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.024165 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved