private String enjoy[]; public String[] getEnjoy() { if (this.enjoy.length==0) 

String[] ss={"足球","篮球"};  
this.enjoy=ss; 

                      return enjoy; 

每次运行的时候都提示错误:org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: Getter for property enjoy threw exception: java.lang.NullPointerException 

解决方案 »

  1.   

    出现空指针异常啦你的jsp有enjoy吗
      

  2.   

    lz分多啊 发了2个啊
    this.enjoy.length==0改成 this.enjoy==null试试
      

  3.   

    如果 this.enjoy 每次都是 {"足球","篮球"} 这2项的话,直接在变量定义的时候写死不就行了. 
    private String[] enjoy = {"足球","篮球"};
    如果是重外部取的话...
    public String[] getEnjoy() {
        if(null == this.enjoy){
        this.enjoy = new String[]{"足球","篮球"};
        }
        return enjoy;
    }