Java不兼容的类型

在写jsp页面遇到了这个不兼容的问题,这是为什么呢,要怎么改

img


页面代码


<%@page import="vo.BookSub"%>
<%@page import="java.util.ArrayList"%>
<%@page import="pa.ProblemADAO"%>
<%@page import="vo.BookSub"%>

<%@page contentType="textcml" pageEncoding="UTF-8"%>

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="textcml; charset=UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>JSP Page</title>
        <link rel="stylesheet" href="<%=request.getContextPath()%>/resćs/bootstrap.min.css" type="textćs" media="screen" />

       
    </head>
    <body>


        
        <h1>按原有顺序显示数据</h1>
        <table class="table table-striped table-bordered">
            <tr>
                  
                <th>订单号</th>
                <th>用户名</th>
                <th>用户真实姓名</th>
                <th>用户email</th>
                <th>地址</th>
                <th>邮政编码</th>
                <th>付款方式</th>
                <th>联系电话</th>
                <th>运送方式</th>
                <th>是否执行</th>
                
            </tr>
            <%
            //String thePath=request.getRealPath("/")+"ch08\\theFile";
                ProblemADAO qdao = new ProblemADAO();
                ArrayList<BookSub> list = qdao.list();
                            //多条记录用while循环
                for (BookSub s : list) {
            %>
                 <tr>
               <tr>
                 <td>
                    <%=s.getSub()%>
                </td>
                <td>
                    <%=s.getUsername()%>
                </td>
                <td>
                    <%=s.getRname()%>
                </td>

                <td>
                    <%=s.getSpdate()%>
                </td>
                
                <td>
                    <%=s.getEmail()%>
                </td>
                
                <td>
                    <%=s.getAddress()%>
                </td>
                
                <td>
                    <%=s.getPost()%>
                </td>
                
                <td>
                    <%=s.getPayment()%>
                </td>
                
                <td>
                    <%=s.getPhoto()%>
                </td>
                
                <td>
                    <%=s.getCarry()%>
                </td>
                
                <td>
                    <%=s.getSpif()%>
                </td>
            </tr>
            <%
                }
            %>
        </table>
    </body>
<cml>

vo代码:

package vo;

/**
 *
 * @author Administrator
 */
public class BookSub implements Comparable{
     int Sub;
     String Username;
     String Rname;
     String Spdate;
     String Email;
     String Address;
     String Post;
     String Payment;
     String Photo;
     String Carry;
     int Spif;

      public BookSub(){
      }

    public BookSub(int Sub, String Username, String Rname, String Spdate, String Email, String Address, String Post, String Payment, String Photo, String Carry, int Spif) {
        this.Sub = Sub;
        this.Username = Username;
        this.Rname = Rname;
        this.Spdate = Spdate;
        this.Email = Email;
        this.Address = Address;
        this.Post = Post;
        this.Payment = Payment;
        this.Photo = Photo;
        this.Carry = Carry;
        this.Spif = Spif;
    }
 

    public int getSub() {
        return Sub;
    }

    public void setSub(int Sub) {
        this.Sub = Sub;
    }

    public String getUsername() {
        return Username;
    }

    public void setUsername(String Username) {
        this.Username = Username;
    }

    public String getRname() {
        return Rname;
    }

    public void setRname(String Rname) {
        this.Rname = Rname;
    }

    public String getSpdate() {
        return Spdate;
    }

    public void setSpdate(String Spdate) {
        this.Spdate = Spdate;
    }

    public String getEmail() {
        return Email;
    }

    public void setEmail(String Email) {
        this.Email = Email;
    }

    public String getAddress() {
        return Address;
    }

    public void setAddress(String Address) {
        this.Address = Address;
    }

    public String getPost() {
        return Post;
    }

    public void setPost(String Post) {
        this.Post = Post;
    }

    public String getPayment() {
        return Payment;
    }

    public void setPayment(String Payment) {
        this.Payment = Payment;
    }

    public String getPhoto() {
        return Photo;
    }

    public void setPhoto(String Photo) {
        this.Photo = Photo;
    }

    public String getCarry() {
        return Carry;
    }

    public void setCarry(String Carry) {
        this.Carry = Carry;
    }

    public int getSpif() {
        return Spif;
    }

    public void setSpif(int Spif) {
        this.Spif = Spif;
    }

    @Override
    public String toString() {
        return "BookSub{" + "Sub=" + Sub + ", Username=" + Username + ", Rname=" + Rname + ", Spdate=" + Spdate + ", Email=" + Email + ", Address=" + Address + ", Post=" + Post + ", Payment=" + Payment + ", Photo=" + Photo + ", Carry=" + Carry + ", Spif=" + Spif + '}';
    }
    
     @Override
    public int compareTo(Object o)
     {
         BookSub other=(BookSub) o;
         return Integer.compare(this.Sub,other.getSub());
     }
}

Pa


package pa;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;

import util.FileUtils;
import vo.BookSub;

/**
 *
 * @author Administrator
 */
public class ProblemADAO {

   

    public  boolean save( ) {
//        try {
//            
//           FileWriter writer = new FileWriter("d:/ks/20204075001/data/a/data.txt");
//           //FileWriter writer = new FileWriter(file);
//           //文件里的数据6-10条
//           BufferedWriter bufferWriter = new BufferedWriter(writer);
           
           try {
            OutputStreamWriter outputStreamWriter= 
                    new OutputStreamWriter(
                            new FileOutputStream("d:/ks/20214075224/data/a/data.txt"),"UTF-8");
            
            
            BufferedWriter bufferWriter = new BufferedWriter(outputStreamWriter);
            bufferWriter.write("001,小明,王明明,2023-01-01,123456789@qq.com,上海,111222,支付宝,15123456700,空运,0");
            bufferWriter.newLine();
            bufferWriter.write("002,小李,王小李,2023-02-02,134678007@qq.com,杭州,222333,现金,14678943005,快递,1");
            bufferWriter.newLine();
                        bufferWriter.write("003,小玉,王小玉,2023-03-03,167854331@qq.com,大庆,333444,现金,15167995427,快递,1");
            bufferWriter.newLine();
                        bufferWriter.write("004,小红,王小红,2023-04-04,156097555@qq.com,北京,444555,现金,17866543209,快递,1");
            bufferWriter.newLine();
                        bufferWriter.write("005,小刚,王小刚,2023-05-05,100967332@qq.com,郑州,555666,支付宝,16855674331,快递,0");
            bufferWriter.newLine();
                        bufferWriter.write("006,小鱼,王小鱼,2023-06-06,136766001@qq.com,河北,666777,现金,100267843229,快递,0");
            bufferWriter.newLine();
                        bufferWriter.write("007,小心,王小心,2023-07-07,167098886@qq.com,南京,777888,现金,187543456554,快递,0");
            bufferWriter.newLine();
                        bufferWriter.write("008,小艾,王小艾,2023-08-08,155764221@qq.com,云南,888999,现金,10900865556,快递,1");
            bufferWriter.newLine();
                        bufferWriter.write("009,小顾,王小顾,2023-09-09,133515775@qq.com,河南,999000,微信支付,15643287990,快递,1");
            bufferWriter.newLine();
                        bufferWriter.write("010,小美,王小美,2023-10-10,130900764@qq.com,沈阳,112211,现金,10988897665,快递,1");
            bufferWriter.newLine();
            bufferWriter.close();
            outputStreamWriter.close();
        } catch (IOException e) {
            // TODO Auto-generated catch block
              System.out.println(e.getMessage());
              return false;
        }
      return true;
    }
    
    /**
     * 显示全部记录
     *
     * @return
     */
    public  ArrayList<BookSub> list() {
     ArrayList<BookSub> booksubs= new ArrayList<BookSub>();
        
        List <String>    datas=FileUtils.readLines("d:/ks/20214075224/data/a/data.txt");
            
        for(String data :datas){
            String temp[]=data.replaceAll("\"","").split(",");
            BookSub booksub=new BookSub(Integer.parseInt(temp[0]),temp[1],temp[2],temp[3],temp[4],temp[5],temp[6],temp[7],temp[8],temp[9],Integer.parseInt(temp[10]));
            booksubs.add(booksub);
        } 
        return booksubs;
    }
    
    //按XXX属性排序。比较器用完整的类实现
    public  ArrayList<BookSub> listsort1() {
        ArrayList<BookSub> all = list();
                   
      //排序        
        
        
        return all;
    }
    
    
  //XXX属性排序。比较器用匿名类实现
    public  ArrayList<BookSub> listsort2() {
        ArrayList<BookSub> all = list();
                   
      //排序        
          
        
        return all;
    }
    
  //按XXX属性排序,比较器用lamda表达式实现
    public  ArrayList<BookSub> listsort3() {
        ArrayList<BookSub> all = list();
                   
        //排序        
          
        
        return all;
    }
    public static void main(String[] args) {
        //save();
        //list();q
    }

    private static class BookSub {

        public BookSub() {
        }

        private BookSub(int parseInt, String string, String string0, String string1, String string2, String string3, String string4, String string5, String string6, String string7, int parseInt0) {
            throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }
    }

    private static class ArrayListBookSub {

        public ArrayListBookSub() {
        }
    }

img

你代码 返回的 pa这个 没用,可以删了吧,你实际要返回 vo包下的,自己修改下

img