jsp是不是不能接收ejb返回的二维数组啊? 可以接收,如果你没有收到,那就是你的代码有问题 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我原来作的东西:bean中如下: /**************************年报返回结果**************************/ public String[][] getYearReport(Statement Stmt, String nf, String UnitID) throws SQLException { ResultSet RS=null; String sqlStr=null,StrTmp=null; int cnt=0;String MontData[][]; //取得数组的一维下标,并填充固定资产分类、分类编码和年折旧率 try { sqlStr="select count(distinct ID) as cnt From E_Category"; RS=Stmt.executeQuery(sqlStr); RS.next(); cnt=RS.getInt("cnt"); RS.close(); } catch(Exception e){System.out.println("Depreciate.java-->getYearReport():" + e.toString());} MontData = new String [cnt+1][17];// //最后一行为累计值,初始化数组 try { sqlStr="select * From E_Category"; RS=Stmt.executeQuery(sqlStr); RS.beforeFirst(); for (int i=0;i<cnt;i++) { RS.next(); MontData[i][0]=RS.getString("Name"); MontData[i][1]=RS.getString("ID"); MontData[i][2]=RS.getString("Percentage2"); } } catch (Exception e) { System.out.println("Depreciate.java-->getYearReport():" + e.toString()); } float fData[][]=new float[cnt+1][14]; try{ //查询表Depreciate for (int i=0;i<cnt;i++) { if ((MontData[i][1].indexOf('*'))!=-1) { StrTmp=MontData[i][1].substring(0,MontData[i][1].indexOf('*')); }else{ StrTmp=MontData[i][1]; } sqlStr="select FLID,NZhJL,avg(JTZhJYZh1+JTZhJYZh2+JTZhJYZh3+JTZhJYZh4+JTZhJYZh5+JTZhJYZh6+JTZhJYZh7+JTZhJYZh8+JTZhJYZh9+JTZhJYZh10+JTZhJYZh11+JTZhJYZh12) as JTZhJYZh"; sqlStr=sqlStr+",sum(ZhJE1+ZhJE2+ZhJE3+ZhJE4+ZhJE5+ZhJE6+ZhJE7+ZhJE8+ZhJE9+ZhJE10+ZhJE11+ZhJE12) as ZhJE"; sqlStr=sqlStr+",sum(ZhJE1) as ZhJE1,sum(ZhJE2) as ZhJE2,sum(ZhJE3) as ZhJE3,sum(ZhJE4) as ZhJE4,sum(ZhJE5) as ZhJE5,sum(ZhJE6) as ZhJE6,sum(ZhJE7) as ZhJE7,sum(ZhJE8) as ZhJE8,sum(ZhJE9) as ZhJE9,sum(ZhJE10) as ZhJE10,sum(ZhJE11) as ZhJE11,sum(ZhJE12) as ZhJE12"; sqlStr=sqlStr+" from Depreciate where NF='"+nf+"' and DW='" +UnitID+ "' and FLID like '"+StrTmp+"%' order by FLID"; RS=Stmt.executeQuery(sqlStr); RS.next(); fData[i][0]=RS.getFloat("JTZhJYZh"); fData[i][1]=RS.getFloat("ZhJE"); fData[i][2]=RS.getFloat("ZhJE1"); fData[i][3]=RS.getFloat("ZhJE2"); fData[i][4]=RS.getFloat("ZhJE3"); fData[i][5]=RS.getFloat("ZhJE4"); fData[i][6]=RS.getFloat("ZhJE5"); fData[i][7]=RS.getFloat("ZhJE6"); fData[i][8]=RS.getFloat("ZhJE7"); fData[i][9]=RS.getFloat("ZhJE8"); fData[i][10]=RS.getFloat("ZhJE9"); fData[i][11]=RS.getFloat("ZhJE10"); fData[i][12]=RS.getFloat("ZhJE11"); fData[i][13]=RS.getFloat("ZhJE12"); } RS.close(); } catch(Exception e){System.out.println("Depreciate.java-->getYearReport():" + e.toString());} //计算“合计” MontData[cnt][0]="合 计"; MontData[cnt][1]="";MontData[cnt][2]="";// for (int j=0;j<14;j++ ) for (int i=0;i<cnt+1 ;i++ ) {fData[cnt][j]+=fData[i][j];} for (int i=0;i<cnt+1 ;i++ ) for (int j=3;j<=16;j++ ) { MontData[i][j]=String.valueOf(fData[i][j-3]); } return MontData; }jsp中:String Data[][] = Dep.getYearReport(Stmt, Year,UnitID);int RowCount = Data.length;for (int i=0; i<=RowCount-1; i++) {System.out.println("Data["+i+"][0]:"+Data[i][0]);} tomcat运行JSP问题 请教servlet运行错误 数据条件查询问题 很简单的JSP问题,初学JSP,很简单,但是有一些基本问题我搞不懂,谢谢指教! zTree牛人请进指导个问题,谢谢了! 一个关于Apache安装的问题 用的 是hibernate框架现在出了点问题 怎样屏避网站的页面的名称 例如www.sina.com.cn 而不是显示www.sina.com.cn/index.html javabena初学者 寻求名词解释!! 想用JSP做一个在线播放视频和音频的程序,怎么实现? 请问一个关于回退的问题
bean中如下:
/**************************年报返回结果**************************/
public String[][] getYearReport(Statement Stmt, String nf, String UnitID) throws SQLException
{
ResultSet RS=null;
String sqlStr=null,StrTmp=null;
int cnt=0;String MontData[][];
//取得数组的一维下标,并填充固定资产分类、分类编码和年折旧率
try
{
sqlStr="select count(distinct ID) as cnt From E_Category";
RS=Stmt.executeQuery(sqlStr);
RS.next();
cnt=RS.getInt("cnt");
RS.close();
}
catch(Exception e){System.out.println("Depreciate.java-->getYearReport():" + e.toString());}
MontData = new String [cnt+1][17];// //最后一行为累计值,初始化数组
try
{
sqlStr="select * From E_Category";
RS=Stmt.executeQuery(sqlStr);
RS.beforeFirst();
for (int i=0;i<cnt;i++)
{
RS.next();
MontData[i][0]=RS.getString("Name");
MontData[i][1]=RS.getString("ID");
MontData[i][2]=RS.getString("Percentage2");
}
}
catch (Exception e)
{
System.out.println("Depreciate.java-->getYearReport():" + e.toString());
}
float fData[][]=new float[cnt+1][14];
try{
//查询表Depreciate
for (int i=0;i<cnt;i++)
{
if ((MontData[i][1].indexOf('*'))!=-1)
{
StrTmp=MontData[i][1].substring(0,MontData[i][1].indexOf('*'));
}else{
StrTmp=MontData[i][1];
}
sqlStr="select FLID,NZhJL,avg(JTZhJYZh1+JTZhJYZh2+JTZhJYZh3+JTZhJYZh4+JTZhJYZh5+JTZhJYZh6+JTZhJYZh7+JTZhJYZh8+JTZhJYZh9+JTZhJYZh10+JTZhJYZh11+JTZhJYZh12) as JTZhJYZh";
sqlStr=sqlStr+",sum(ZhJE1+ZhJE2+ZhJE3+ZhJE4+ZhJE5+ZhJE6+ZhJE7+ZhJE8+ZhJE9+ZhJE10+ZhJE11+ZhJE12) as ZhJE";
sqlStr=sqlStr+",sum(ZhJE1) as ZhJE1,sum(ZhJE2) as ZhJE2,sum(ZhJE3) as ZhJE3,sum(ZhJE4) as ZhJE4,sum(ZhJE5) as ZhJE5,sum(ZhJE6) as ZhJE6,sum(ZhJE7) as ZhJE7,sum(ZhJE8) as ZhJE8,sum(ZhJE9) as ZhJE9,sum(ZhJE10) as ZhJE10,sum(ZhJE11) as ZhJE11,sum(ZhJE12) as ZhJE12";
sqlStr=sqlStr+" from Depreciate where NF='"+nf+"' and DW='" +UnitID+ "' and FLID like '"+StrTmp+"%' order by FLID";
RS=Stmt.executeQuery(sqlStr);
RS.next();
fData[i][0]=RS.getFloat("JTZhJYZh");
fData[i][1]=RS.getFloat("ZhJE");
fData[i][2]=RS.getFloat("ZhJE1");
fData[i][3]=RS.getFloat("ZhJE2");
fData[i][4]=RS.getFloat("ZhJE3");
fData[i][5]=RS.getFloat("ZhJE4");
fData[i][6]=RS.getFloat("ZhJE5");
fData[i][7]=RS.getFloat("ZhJE6");
fData[i][8]=RS.getFloat("ZhJE7");
fData[i][9]=RS.getFloat("ZhJE8");
fData[i][10]=RS.getFloat("ZhJE9");
fData[i][11]=RS.getFloat("ZhJE10");
fData[i][12]=RS.getFloat("ZhJE11");
fData[i][13]=RS.getFloat("ZhJE12");
}
RS.close();
}
catch(Exception e){System.out.println("Depreciate.java-->getYearReport():" + e.toString());}
//计算“合计”
MontData[cnt][0]="合 计";
MontData[cnt][1]="";MontData[cnt][2]="";//
for (int j=0;j<14;j++ )
for (int i=0;i<cnt+1 ;i++ )
{fData[cnt][j]+=fData[i][j];}
for (int i=0;i<cnt+1 ;i++ )
for (int j=3;j<=16;j++ )
{
MontData[i][j]=String.valueOf(fData[i][j-3]);
} return MontData;
}jsp中:
String Data[][] = Dep.getYearReport(Stmt, Year,UnitID);
int RowCount = Data.length;
for (int i=0; i<=RowCount-1; i++)
{System.out.println("Data["+i+"][0]:"+Data[i][0]);}