大哥哥们,帮忙。很简单的问题。
我写的*.jsp:
<%@ page contentType="text/html;charset=gb2312" %>
<html>
<head>
<title> 彩票 </title>
</head>
<body>
<jsp:useBean id="aa" class ="lottery.aBean" scope="session" />
<%
aa.paiXu();
int c = aa.getLength();
int[] www = new int[c];
www = aa.getResult();
%>
</body>
</html>
---------------------------------
我写的bean:
package lottery;
public class aBean{
private int[] b = new int[6];
//构造函数
aBean(){
produce();
}
//从0-33中产生6个不同的整数。
public void produce(){
this.b[0] = 1 + (int)(Math.random() * 33);
for(int i = 1;i < this.b.length;i++){
this.b[i] = 1 + (int)(Math.random() * 33);
for(int j = 0;j < i;j++){
if(this.b[i] == this.b[j]){
j=0;
this.b[i] = 1 + (int)(Math.random() * 33);
}
}
}
}
//从小到大排序
public void paiXu(){
for(int m = 0;m < this.b.length-1; m++){
for(int n = 0;n < this.b.length - m - 1;n++){
if(b[n] > this.b[n + 1]){
int temp;
temp = this.b[n];
this.b[n] = this.b[n + 1];
this.b[n + 1] = temp;
}
}
}
}
//得到数组长度
public int getLength(){
return this.b.length;
}
//得到排序后的结果
public int[] getResult(){
return this.b;
}
public String dfs(){
return "aaaaawfwf";
}
}
它们的放置位置没问题运行时出错:
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: class lottery.aBean : java.lang.IllegalAccessException: Class java.beans.Beans can not access a member of class lottery.aBean with modifiers ""
...
...
请看一下是什么错。thanks!