jsp内容如下:<html>
<head>
<title>密码生成器</title>
</head>
<body>
<jsp:useBean id="pass" scope="session" class="ch4.PasswordBean" />
<jsp:setProperty name="pass" property="numDigit" value="6"/>
<% ch4.PasswordBean.createPassword();%> 
随机生成密码:<font color="#663366">
<jsp:getProperty name="pass" property="password"/>/font><br>
</body>
</html>bean内容如下:
package ch4;import java.util.*;
import java.io.Serializable;
public class PasswordBean implements Serializable{
private int numDigit;
private long password; public PasswordBean(){
numDigit=6;
password=123456;
}
//
public void setNumDigit(int n){
if(n<6)
numDigit=n;
else
numDigit=6;
}

public void createPassword(){
double d=Math.random();
int n=1;
for(int i=0;i<numDigit;i++)
n=n*10;
password=(long)(d*n)+1;
}
//取得变量值
public int getNumDigit()
{
return numDigit;
}

public  long getPassword()
{
return password;
}
}
报错内容如下:
org.apache.jasper.JasperException: Unable to compile class for JSPAn error occurred at line: 8 in the jsp file: /chap4-2.jsp
Generated servlet error:
Cannot make a static reference to the non-static method createPassword() from the type PasswordBean
大家帮忙看一下该怎么改才能解决!谢谢!