⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bookdbservlet.java

📁 初期JAVA学习非常有用的资料。帮助深入了解API。特别是Applet。
💻 JAVA
字号:
/*Copyright (c) 1998 Sun Microsystems, Inc. All Rights Reserved.This software is the confidential and proprietary information of SunMicrosystems, Inc. ("Confidential Information").  You shall notdisclose such Confidential Information and shall use it only inaccordance with the terms of the license agreement you entered intowith Sun.SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THESOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THEIMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULARPURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGESSUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTINGTHIS SOFTWARE OR ITS DERIVATIVES.CopyrightVersion 1.0*/package database;import java.io.*;import javax.servlet.*;/** * This is a simple example of a Generic Servlet.  Other servlets * call its public methods; it does not accept calls from clients. */public class BookDBServlet extends GenericServlet {    private BookstoreDB books;    public void init(ServletConfig config) throws ServletException {        // Store the ServletConfig object and log the initialization        super.init(config);        // Load the database to prepare for requests        books = new BookstoreDB();    }    public void destroy() {        // Allow the database to be garbage collected        books = null;    }    public void service(ServletRequest req, ServletResponse res)	throws ServletException, IOException {            throw new UnavailableException(                this,                "This servlet does not accept client requests.");    }    public BookDetails getBookDetails(String bookId) {        return books.getBookDetails(bookId);    }    public BookDetails[] getBooksSortedByTitle() {        return books.getBooksSortedByTitle();    }    public int getNumberOfBooks() {        return books.getNumberOfBooks();    }    public String getServletInfo() {        return "The BookDB servlet manages the bookstore database.  " +               "It is called by other servlets, not directly by a user.";    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -