package com public class mine{ public int[] y(){ int[] i = new int[2]; i[0]=1; i[1]=2; return i; } }<jsp:useBean id='show' class="com.mine"> <% int[] x=show.y();
%>
<% int[] x=show.getRecid();
%>
首先你要传入一个数组啊. int x=new int[]; show.setRecid(x);
int x=new int[]; 这句话对吗?! 在bean中用set和get方法就可以了 class myBean{ private int[] y=null; public void setY( int[] y ){ this.y = y ; } public int[] getY(){ return y ; } }
int[] i = new int[2]; 初始化的时候要指定数组大小
int[] x= new int[]; 这只是初始化并创建一个实例。 <% int[] x=show.getRecid(); %> 可以了。
我的bean中是这样定义的
private int[] recid
public int[] getRecid() {
return recid;
}
public void setRecid(int[] recid) {
this.recid = recid;
}
在jsp中我如何取这个自定义数组呀
public class mine{
public int[] y(){
int[] i = new int[2];
i[0]=1;
i[1]=2;
return i;
}
}<jsp:useBean id='show' class="com.mine">
<%
int[] x=show.y();
%>
int[] x=show.getRecid();
%>
int x=new int[];
show.setRecid(x);
这句话对吗?!
在bean中用set和get方法就可以了
class myBean{
private int[] y=null;
public void setY( int[] y ){
this.y = y ;
}
public int[] getY(){
return y ;
}
}
初始化的时候要指定数组大小
这只是初始化并创建一个实例。
<%
int[] x=show.getRecid();
%>
可以了。