大哥哥们,帮忙。很简单的问题。

everest_wf 2004-12-15 11:13:32
我写的*.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!

...全文
87 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
jFresH_MaN 2004-12-15
  • 打赏
  • 举报
回复
public aBean(){
produce();
}
构造方法必须是public
ggjjzhzz 2004-12-15
  • 打赏
  • 举报
回复
是不是在什么地方用中文输入了双引号?
everest_wf 2004-12-15
  • 打赏
  • 举报
回复
up
lockljd 2004-12-15
  • 打赏
  • 举报
回复
http://www.netyi.net/in.asp?id=lockllb//大量的教程!几乎包含了有关于计算机的一切!!!!!!

everest_wf 2004-12-15
  • 打赏
  • 举报
回复
up

81,116

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧