MVC和JSP中的Javabean

MVC和JSP中的Javabean,java,jsp,javabeans,Java,Jsp,Javabeans,我有一个java网站的MVC项目 我在Eclipse中编写代码,使用Tomcat和derby数据库 我有以下javabean: package collaboration; import java.sql.*; import org.apache.derby.jdbc.ClientDriver; public class Modello { private String tipoInfo; private String ur = "jdbc:derby:/User

我有一个java网站的MVC项目

我在Eclipse中编写代码,使用Tomcat和derby数据库

我有以下javabean:

package collaboration;
import java.sql.*;
import org.apache.derby.jdbc.ClientDriver;

public class Modello {



    private String tipoInfo;
        private String ur = "jdbc:derby:/Users/sample;create=true";
        private String us = "ciao";
        private String p = "ciao";

        public Modello(){
            this.tipoInfo = "sconosciuto";
        }

        public String getTipoInfo(){
            return this.tipoInfo;
        }

        public void setTipoInfo(String tipoInfo){
            this.tipoInfo = tipoInfo;
        }

        public String getCatalogo(){

            String risultato = null;

            try{

                DriverManager.registerDriver(new ClientDriver());
                Connection connect = DriverManager.getConnection(ur, us, p);
                PreparedStatement statement = connect.prepareStatement("select titolo, autore, prezzo from libreria.libro");
                ResultSet controllo = statement.executeQuery();

                while(controllo.next()){
                    risultato += controllo.getString(1);
                }

                connect.close();

            } catch(Exception e){
                System.out.println(e);
            }

            return risultato;
        }

        public static void main(String[] args){
            Modello ciao = new Modello();
            System.out.println(ciao.getCatalogo());
        }

}
如果我把这段代码作为java程序单独运行,它就可以正常工作。但如果我在Tomcat服务器的JSP页面中将其用作javabean,我会遇到以下问题:java.sql.SQLException:没有找到适合jdbc的驱动程序:derby:/Users/sample;create=true

这是我在JSP中用于javabean的代码

<%@page import="collaboration.Modello"%>
<jsp:useBean id="model" scope="page" class="collaboration.Modello" />
<jsp:setProperty name="model" property="*" />
<jsp:getProperty name="model" property="catalogo" />


怎么了?

您是否将derby jdbc jar放在WEB应用程序的WEB-INF/lib文件夹中了?是的,我放了,但它仍然不起作用