在下面的代码片段中,我使用一个类来获取对 BookList 实例的引用。这个类有一个 getBook() 方法,它从一个表示 isbn 代码的字符串中返回一个 Book 的实例。该指令在 HttpServlet 的 doGet() 方法中运行。
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Book book = GlobalVar.bookList.getBook( request.getParameter("isbn") );
//
}
您认为在这种情况下使用速记符号有哪些潜在问题?
PS:Global 类将被替换为 ServletContext。