Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/389.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 会话跟踪CoreServlet购物车示例_Java_Session_Servlets - Fatal编程技术网

Java 会话跟踪CoreServlet购物车示例

Java 会话跟踪CoreServlet购物车示例,java,session,servlets,Java,Session,Servlets,我正在学习Marty Hall的“核心servlet和JavaServer页面”。我试图学习第9章第节中“使用购物车和会话跟踪的在线商店”的示例。4. 我已经下载并编译了所有代码。我试图使其运行,但收到HTTP状态404-/OrderPage 类型状态报告 消息/订单页 说明请求的资源不可用 ApacheTomcat/7.0.34 我试图通过在order page servlet中添加@WebServlet(“OrderPage”)来解决这个问题,但这并不能解决这个问题。那么,有什么想法会导致这

我正在学习Marty Hall的“核心servlet和JavaServer页面”。我试图学习第9章第节中“使用购物车和会话跟踪的在线商店”的示例。4. 我已经下载并编译了所有代码。我试图使其运行,但收到HTTP状态404-/OrderPage

类型状态报告

消息/订单页

说明请求的资源不可用

ApacheTomcat/7.0.34

我试图通过在order page servlet中添加@WebServlet(“OrderPage”)来解决这个问题,但这并不能解决这个问题。那么,有什么想法会导致这个问题吗

1. CatalogPage.java 

package coreservlets;

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;

/** Base class for pages showing catalog entries.
 *  Servlets that extend this class must specify
 *  the catalog entries that they are selling and the page
 *  title <I>before</I> the servlet is ever accessed. This
 *  is done by putting calls to setItems and setTitle
 *  in init.
 *  <P>
 *  Taken from Core Servlets and JavaServer Pages
 *  from Prentice Hall and Sun Microsystems Press,
 *  http://www.coreservlets.com/.
 *  &copy; 2000 Marty Hall; may be freely used or adapted.
 */

public abstract class CatalogPage extends HttpServlet {
  private Item[] items;
  private String[] itemIDs;
  private String title;

  /** Given an array of item IDs, look them up in the
   *  Catalog and put their corresponding Item entry
   *  into the items array. The Item contains a short
   *  description, a long description, and a price,
   *  using the item ID as the unique key.
   *  <P>
   *  Servlets that extend CatalogPage <B>must</B> call
   *  this method (usually from init) before the servlet
   *  is accessed.
   */

  protected void setItems(String[] itemIDs) {
    this.itemIDs = itemIDs;
    items = new Item[itemIDs.length];
    for(int i=0; i<items.length; i++) {
      items[i] = Catalog.getItem(itemIDs[i]);
    }
  }

  /** Sets the page title, which is displayed in
   *  an H1 heading in resultant page.
   *  <P>
   *  Servlets that extend CatalogPage <B>must</B> call
   *  this method (usually from init) before the servlet
   *  is accessed.
   */

  protected void setTitle(String title) {
    this.title = title;
  }

  /** First display title, then, for each catalog item,
   *  put its short description in a level-two (H2) heading
   *  with the price in parentheses and long description
   *  below. Below each entry, put an order button
   *  that submits info to the OrderPage servlet for
   *  the associated catalog entry.
   *  <P>
   *  To see the HTML that results from this method, do
   *  "View Source" on KidsBooksPage or TechBooksPage, two
   *  concrete classes that extend this abstract class.
   */

  public void doGet(HttpServletRequest request,
                    HttpServletResponse response)
      throws ServletException, IOException {
    response.setContentType("text/html");
    if (items == null) {
      response.sendError(response.SC_NOT_FOUND,
                         "Missing Items.");
      return;
    }
    PrintWriter out = response.getWriter();
    out.println(ServletUtilities.headWithTitle(title) +
                "<BODY BGCOLOR=\"#FDF5E6\">\n" +
                "<H1 ALIGN=\"CENTER\">" + title + "</H1>");
    Item item;
    for(int i=0; i<items.length; i++) {
      out.println("<HR>");
      item = items[i];
      // Show error message if subclass lists item ID
      // that's not in the catalog.
      if (item == null) {
        out.println("<FONT COLOR=\"RED\">" +
                    "Unknown item ID " + itemIDs[i] +
                    "</FONT>");
      } else {
        out.println();
        String formURL =
          "/servlet/coreservlets.OrderPage";
        // Pass URLs that reference own site through encodeURL.
        formURL = response.encodeURL(formURL);
        out.println
          ("<FORM ACTION=\"" + formURL + "\">\n" +
           "<INPUT TYPE=\"HIDDEN\" NAME=\"itemID\" " +
           "       VALUE=\"" + item.getItemID() + "\">\n" +
           "<H2>" + item.getShortDescription() +
           " ($" + item.getCost() + ")</H2>\n" +
           item.getLongDescription() + "\n" +
           "<P>\n<CENTER>\n" +
           "<INPUT TYPE=\"SUBMIT\" " +
           "VALUE=\"Add to Shopping Cart\">\n" +
           "</CENTER>\n<P>\n</FORM>");
}
    }
    out.println("<HR>\n</BODY></HTML>");
  }

  /** POST and GET requests handled identically. */

  public void doPost(HttpServletRequest request,
                     HttpServletResponse response)
      throws ServletException, IOException {
    doGet(request, response);
  }
}
2. KidsBookPage.java 
package coreservlets;

/** A specialization of the CatalogPage servlet that
 *  displays a page selling three famous kids-book series.
 *  Orders are sent to the OrderPage servlet.
 *  <P>
 *  Taken from Core Servlets and JavaServer Pages
 *  from Prentice Hall and Sun Microsystems Press,
 *  http://www.coreservlets.com/.
 *  &copy; 2000 Marty Hall; may be freely used or adapted.
 */

public class KidsBooksPage extends CatalogPage {
  public void init() {
    String[] ids = { "lewis001", "alexander001", "rowling001" };
    setItems(ids);
    setTitle("All-Time Best Children's Fantasy Books");
  }
}
3. TechBooksPage.java 
package coreservlets;

/** A specialization of the CatalogPage servlet that
 *  displays a page selling two famous computer books.
 *  Orders are sent to the OrderPage servlet.
 *  <P>
 *  Taken from Core Servlets and JavaServer Pages
 *  from Prentice Hall and Sun Microsystems Press,
 *  http://www.coreservlets.com/.
 *  &copy; 2000 Marty Hall; may be freely used or adapted.
 */

public class TechBooksPage extends CatalogPage {
  public void init() {
    String[] ids = { "hall001", "hall002" };
    setItems(ids);
    setTitle("All-Time Best Computer Books");
  }
}
4. OrderPage.java 
package coreservlets;

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import java.text.NumberFormat;

/** Shows all items currently in ShoppingCart. Clients
 *  have their own session that keeps track of which
 *  ShoppingCart is theirs. If this is their first visit
 *  to the order page, a new shopping cart is created.
 *  Usually, people come to this page by way of a page
 *  showing catalog entries, so this page adds an additional
 *  item to the shopping cart. But users can also
 *  bookmark this page, access it from their history list,
 *  or be sent back to it by clicking on the "Update Order"
 *  button after changing the number of items ordered.
 *  <P>
 *  Taken from Core Servlets and JavaServer Pages
 *  from Prentice Hall and Sun Microsystems Press,
 *  http://www.coreservlets.com/.
 *  &copy; 2000 Marty Hall; may be freely used or adapted.
 */

public class OrderPage extends HttpServlet {
  public void doGet(HttpServletRequest request,
                    HttpServletResponse response)
      throws ServletException, IOException {
    HttpSession session = request.getSession(true);
    ShoppingCart cart;
    synchronized(session) {
      cart = (ShoppingCart)session.getValue("shoppingCart");
      // New visitors get a fresh shopping cart.
      // Previous visitors keep using their existing cart.
      if (cart == null) {
        cart = new ShoppingCart();
        session.putValue("shoppingCart", cart);
      }
      String itemID = request.getParameter("itemID");
      if (itemID != null) {
        String numItemsString =
          request.getParameter("numItems");
        if (numItemsString == null) {
          // If request specified an ID but no number,
          // then customers came here via an "Add Item to Cart"
          // button on a catalog page.
          cart.addItem(itemID);
        } else {
          // If request specified an ID and number, then
          // customers came here via an "Update Order" button
          // after changing the number of items in order.
          // Note that specifying a number of 0 results
          // in item being deleted from cart.
          int numItems;
          try {
            numItems = Integer.parseInt(numItemsString);
          } catch(NumberFormatException nfe) {
            numItems = 1;
          }
          cart.setNumOrdered(itemID, numItems);
        }
      }
    }
    // Whether or not the customer changed the order, show
    // order status.
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    String title = "Status of Your Order";
    out.println(ServletUtilities.headWithTitle(title) +
                "<BODY BGCOLOR=\"#FDF5E6\">\n" +
                "<H1 ALIGN=\"CENTER\">" + title + "</H1>");
    synchronized(session) {
      Vector itemsOrdered = cart.getItemsOrdered();
      if (itemsOrdered.size() == 0) {
        out.println("<H2><I>No items in your cart...</I></H2>");
      } else {
        // If there is at least one item in cart, show table
        // of items ordered.
        out.println
          ("<TABLE BORDER=1 ALIGN=\"CENTER\">\n" +
           "<TR BGCOLOR=\"#FFAD00\">\n" +
           "  <TH>Item ID<TH>Description\n" +
           "  <TH>Unit Cost<TH>Number<TH>Total Cost");
        ItemOrder order;

        // Rounds to two decimal places, inserts dollar
        // sign (or other currency symbol), etc., as
        // appropriate in current Locale.
        NumberFormat formatter =
          NumberFormat.getCurrencyInstance();

        String formURL =
          "/OrderPage";
        // Pass URLs that reference own site through encodeURL.
        formURL = response.encodeURL(formURL);

        // For each entry in shopping cart, make
        // table row showing ID, description, per-item
        // cost, number ordered, and total cost.
        // Put number ordered in textfield that user
        // can change, with "Update Order" button next
        // to it, which resubmits to this same page
        // but specifying a different number of items.
        for(int i=0; i<itemsOrdered.size(); i++) {
          order = (ItemOrder)itemsOrdered.elementAt(i);
          out.println
            ("<TR>\n" +
             "  <TD>" + order.getItemID() + "\n" +
             "  <TD>" + order.getShortDescription() + "\n" +
             "  <TD>" +
             formatter.format(order.getUnitCost()) + "\n" +
             "  <TD>" +
             "<FORM ACTION=\"" + formURL + "\">\n" +
             "<INPUT TYPE=\"HIDDEN\" NAME=\"itemID\"\n" +
             "       VALUE=\"" + order.getItemID() + "\">\n" +
             "<INPUT TYPE=\"TEXT\" NAME=\"numItems\"\n" +
             "       SIZE=3 VALUE=\"" + 
             order.getNumItems() + "\">\n" +
             "<SMALL>\n" +
             "<INPUT TYPE=\"SUBMIT\"\n "+
             "       VALUE=\"Update Order\">\n" +
             "</SMALL>\n" +
             "</FORM>\n" +
             "  <TD>" +
             formatter.format(order.getTotalCost()));
        }
        String checkoutURL =
          response.encodeURL("/Checkout.html");
        // "Proceed to Checkout" button below table
        out.println
          ("</TABLE>\n" +
           "<FORM ACTION=\"" + checkoutURL + "\">\n" +
           "<BIG><CENTER>\n" +
           "<INPUT TYPE=\"SUBMIT\"\n" +
           "       VALUE=\"Proceed to Checkout\">\n" +
           "</CENTER></BIG></FORM>");
      }
      out.println("</BODY></HTML>");
    }
  }

  /** POST and GET requests handled identically. */

  public void doPost(HttpServletRequest request,
                     HttpServletResponse response)
      throws ServletException, IOException {
    doGet(request, response);
  }
}
5. ShoppingCart.java 
package coreservlets;

import java.util.*;

/** A shopping cart data structure used to track orders.
 *  The OrderPage servlet associates one of these carts
 *  with each user session.
 *  <P>
 *  Taken from Core Servlets and JavaServer Pages
 *  from Prentice Hall and Sun Microsystems Press,
 *  http://www.coreservlets.com/.
 *  &copy; 2000 Marty Hall; may be freely used or adapted.
 */

public class ShoppingCart {
  private Vector itemsOrdered;

  /** Builds an empty shopping cart. */

  public ShoppingCart() {
    itemsOrdered = new Vector();
  }

  /** Returns Vector of ItemOrder entries giving
   *  Item and number ordered.
   */

  public Vector getItemsOrdered() {
    return(itemsOrdered);
  }

  /** Looks through cart to see if it already contains
   *  an order entry corresponding to item ID. If it does,
   *  increments the number ordered. If not, looks up
   *  Item in catalog and adds an order entry for it.
   */

  public synchronized void addItem(String itemID) {
    ItemOrder order;
    for(int i=0; i<itemsOrdered.size(); i++) {
      order = (ItemOrder)itemsOrdered.elementAt(i);
      if (order.getItemID().equals(itemID)) {
        order.incrementNumItems();
        return;
      }
    }
    ItemOrder newOrder = new ItemOrder(Catalog.getItem(itemID));
    itemsOrdered.addElement(newOrder);
  }

  /** Looks through cart to find order entry corresponding
   *  to item ID listed. If the designated number
   *  is positive, sets it. If designated number is 0
   *  (or, negative due to a user input error), deletes
   *  item from cart.
   */

  public synchronized void setNumOrdered(String itemID,
                                         int numOrdered) {
    ItemOrder order;
    for(int i=0; i<itemsOrdered.size(); i++) {
      order = (ItemOrder)itemsOrdered.elementAt(i);
      if (order.getItemID().equals(itemID)) {
        if (numOrdered <= 0) {
          itemsOrdered.removeElementAt(i);
        } else {
          order.setNumItems(numOrdered);
        }
        return;
      }
    }
    ItemOrder newOrder =
      new ItemOrder(Catalog.getItem(itemID));
    itemsOrdered.addElement(newOrder);
  }
}
6. Item.java 
package coreservlets;

/** Describes a catalog item for on-line store. The itemID
 *  uniquely identifies the item, the short description
 *  gives brief info like the book title and author,
 *  the long description describes the item in a couple
 *  of sentences, and the cost gives the current per-item price.
 *  Both the short and long descriptions can contain HTML
 *  markup.
 *  <P>
 *  Taken from Core Servlets and JavaServer Pages
 *  from Prentice Hall and Sun Microsystems Press,
 *  http://www.coreservlets.com/.
 *  &copy; 2000 Marty Hall; may be freely used or adapted.
 */

public class Item {
  private String itemID;
  private String shortDescription;
  private String longDescription;
  private double cost;

  public Item(String itemID, String shortDescription,
              String longDescription, double cost) {
    setItemID(itemID);
    setShortDescription(shortDescription);
    setLongDescription(longDescription);
    setCost(cost);
  }

  public String getItemID() {
    return(itemID);
  }

  protected void setItemID(String itemID) {
    this.itemID = itemID;
  }

  public String getShortDescription() {
    return(shortDescription);
  }

  protected void setShortDescription(String shortDescription) {
    this.shortDescription = shortDescription;
  }

  public String getLongDescription() {
    return(longDescription);
  }

  protected void setLongDescription(String longDescription) {
    this.longDescription = longDescription;
  }

  public double getCost() {
    return(cost);
  }

  protected void setCost(double cost) {
    this.cost = cost;
  }
}
7. ItemOrder.java 
package coreservlets;

/** Associates a catalog Item with a specific order by
 *  keeping track of the number ordered and the total price.
 *  Also provides some convenience methods to get at the
 *  Item data without first extracting the Item separately.
 *  <P>
 *  Taken from Core Servlets and JavaServer Pages
 *  from Prentice Hall and Sun Microsystems Press,
 *  http://www.coreservlets.com/.
 *  &copy; 2000 Marty Hall; may be freely used or adapted.
 */

public class ItemOrder {
  private Item item;
  private int numItems;

  public ItemOrder(Item item) {
    setItem(item);
    setNumItems(1);
  }

  public Item getItem() {
    return(item);
  }

  protected void setItem(Item item) {
    this.item = item;
  }

  public String getItemID() {
    return(getItem().getItemID());
  }

  public String getShortDescription() {
    return(getItem().getShortDescription());
  }

  public String getLongDescription() {
    return(getItem().getLongDescription());
  }

  public double getUnitCost() {
    return(getItem().getCost());
  }

  public int getNumItems() {
    return(numItems);
  }

  public void setNumItems(int n) {
    this.numItems = n;
  }

  public void incrementNumItems() {
    setNumItems(getNumItems() + 1);
  }

  public void cancelOrder() {
    setNumItems(0);
  }

  public double getTotalCost() {
    return(getNumItems() * getUnitCost());
  }
}
8. Catalog.java 
package coreservlets;

/** A catalog listing the items available in inventory.
 *  <P>
 *  Taken from Core Servlets and JavaServer Pages
 *  from Prentice Hall and Sun Microsystems Press,
 *  http://www.coreservlets.com/.
 *  &copy; 2000 Marty Hall; may be freely used or adapted.
 */

public class Catalog {
  // This would come from a database in real life
  private static Item[] items =
    { new Item("hall001",
               "<I>Core Servlets and JavaServer Pages</I> " +
                 " by Marty Hall",
               "The definitive reference on servlets " +
                 "and JSP from Prentice Hall and \n" +
                 "Sun Microsystems Press. Nominated for " +
                 "the Nobel Prize in Literature.",
               39.95),
      new Item("hall002",
               "<I>Core Web Programming, Java2 Edition</I> " +
                 "by Marty Hall, Larry Brown, and " +
                 "Paul McNamee",
               "One stop shopping for the Web programmer. " +
                 "Topics include \n" +
                 "<UL><LI>Thorough coverage of Java 2; " +
                 "including Threads, Networking, Swing, \n" +
                 "Java2D, and Collections\n" +
                 "<LI>A fast introduction to HTML 4.01, " +
                 "including frames, style sheets, layers,\n" +
                 "and Netscape and Internet Explorer " +
                 "extensions.\n" +
                 "<LI>A fast introduction to HTTP 1.1, " +
                 "servlets, and JavaServer Pages.\n" +
                 "<LI>A quick overview of JavaScript 1.2\n" +
                 "</UL>",
               49.95),
      new Item("lewis001",
               "<I>The Chronicles of Narnia</I> by C.S. Lewis",
               "The classic children's adventure pitting " +
                 "Aslan the Great Lion and his followers\n" +
                 "against the White Witch and the forces " +
                 "of evil. Dragons, magicians, quests, \n" +
                 "and talking animals wound around a deep " +
                 "spiritual allegory. Series includes\n" +
                 "<I>The Magician's Nephew</I>,\n" +
                 "<I>The Lion, the Witch and the " +
                   "Wardrobe</I>,\n" +
                 "<I>The Horse and His Boy</I>,\n" +
                 "<I>Prince Caspian</I>,\n" +
                 "<I>The Voyage of the Dawn " +
                   "Treader</I>,\n" +
                 "<I>The Silver Chair</I>, and \n" +
                 "<I>The Last Battle</I>.",
               19.95),
      new Item("alexander001",
               "<I>The Prydain Series</I> by Lloyd Alexander",
               "Humble pig-keeper Taran joins mighty " +
                 "Lord Gwydion in his battle against\n" +
                 "Arawn the Lord of Annuvin. Joined by " +
                 "his loyal friends the beautiful princess\n" +
                 "Eilonwy, wannabe bard Fflewddur Fflam," +
                 "and furry half-man Gurgi, Taran discovers " +
                 "courage, nobility, and other values along\n" +
                 "the way. Series includes\n" +
                 "<I>The Book of Three</I>,\n" +
                 "<I>The Black Cauldron</I>,\n" +
                 "<I>The Castle of Llyr</I>,\n" +
                 "<I>Taran Wanderer</I>, and\n" +
                 "<I>The High King</I>.",
               19.95),
      new Item("rowling001",
               "<I>The Harry Potter Trilogy</I> by " +
                 "J.K. Rowling",
               "The first three of the popular stories " +
                 "about wizard-in-training Harry Potter\n" +
                 "topped both the adult and children's " +
                 "best-seller lists. Series includes\n" +
                 "<I>Harry Potter and the " +
                   "Sorcerer's Stone</I>,\n" +
                 "<I>Harry Potter and the " +
                   "Chamber of Secrets</I>, and\n" +
                 "<I>Harry Potter and the " +
                   "Prisoner of Azkaban</I>.",
               25.95)
    };

  public static Item getItem(String itemID) {
    Item item;
    if (itemID == null) {
      return(null);
    }
    for(int i=0; i<items.length; i++) {
      item = items[i];
      if (itemID.equals(item.getItemID())) {
        return(item);
      }
    }
    return(null);
  }
}
9. CheckOut.html 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
  <TITLE>Checkout</TITLE>
</HEAD>

<BODY BGCOLOR="#FDF5E6">
<H2 ALIGN="CENTER">Checkout</H2>

We're sorry, but we are unable to handle credit card orders
at this time. Please make out a check to Marty Hall, 
Research and Technology Development Center, Johns Hopkins 
Applied Physics Lab, 11100 Johns Hopkins Rd.,
Laurel, MD 20723. 
<P>
To expedite your order, please do <I>not</I> fill in the amount.
I'll do that after I decide where I want to take my next
vacation.
</BODY>
</HTML>
1。CatalogPage.java
包coreservlet;
导入java.io.*;
导入javax.servlet.*;
导入javax.servlet.http.*;
导入java.util.*;
/**显示目录项的页面的基类。
*扩展此类的servlet必须指定
*他们正在销售的目录条目和页面
*在访问servlet之前的标题。这
*通过调用setItems和setTitle来完成
*在init中。
*

*取自核心servlet和JavaServer页面 *来自普伦蒂斯大厅和太阳微系统出版社, * http://www.coreservlets.com/. *&复制;2000年马蒂厅;可以自由使用或改编。 */ 公共抽象类CatalogPage扩展了HttpServlet{ 私人物品[]项; 私有字符串[]itemIDs; 私有字符串标题; /**给定一个项目ID数组,在 *编目并放入相应的项目条目 *进入items数组。该项包含一个 *描述、详细描述和价格, *使用项目ID作为唯一键。 *

*扩展CatalogPage的servlet必须调用 *此方法(通常来自init)在servlet之前 *访问。 */ 受保护的无效集合项(字符串[]项ID){ this.itemIDs=itemIDs; items=新项目[ItemId.length];


对于(inti=0;i您使用哪个版本的servlet?
如果2.5或更低版本,则不支持批注。您需要在web-INF中创建web.xml文件,并设置如下:

    <servlet>
        <servlet-name>SecondServlet</servlet-name>
        <servlet-class>ru.bmstu.SecondServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>SecondServlet</servlet-name>
        <url-pattern>/1.do</url-pattern>
    </servlet-mapping>

第二个servlet
ru.bmstu.SecondServlet
第二个servlet
/1.do

好的,我发现OrderPage和CatalogPage中有一个表单操作标记,它保存着servlet的URL
字符串formURL=
“/OrderPage”;
//通过encodeURL传递引用自己站点的URL。

formURL=response.encodeURL(formURL);…“\n”…
这不能包括斜杠,所以当我删除斜杠时,我有来自服务器的响应,所以“/OrderPage”必须更改为“OrderPage”。我在查看其他Servlet工作示例时发现了这一点。我认为要使此代码按设计方式工作,我必须删除/以所有形式删除动作标记。多亏viartemev的回答,我正在使用apache的3.0版本7@user3396201您需要这样的web.xml:。您使用的url是什么?当我将此代码粘贴到web.xml中时,我就知道了ve:元素类型“web app”后面必须跟属性规范“>”或“/>”。该web.xml实际做什么???@user3396201/web-INF/web.xml文件是应用程序的web应用程序部署描述符。该文件是一个xml文档,定义了服务器需要了解的有关应用程序的所有信息(上下文路径除外,该路径在部署应用程序时由应用程序部署人员和管理员分配):servlet和其他组件,如筛选器或侦听器、初始化参数、容器管理的安全约束、资源、欢迎页面等。