Coffee Cram: Chapter 5 Answers

  1. When using a RequestDispatcher, the use of which methods can often lead to an IllegalStateException? (Choose all that apply.)

    (Servlet v2.4 pg. 167)

    A.

    read

    B.

    flush

    C.

    write

    D.

    getOutputStream

    E.

    getResourceAsStream

    Note

    -An IllegalStateException is caused when a response has already been ‘committed’ to the client (the flush method does that), and then you attempt a forward.

  2. Which statements about ServletContext initialization parameters are true? (Choose all that apply.)

    (Servlet v2.4 pg. 31)

    A.

    They should be used for data that changes rarely.

    B.

    They should be used for data that changes frequently.

    C.

    They can be accessed using

    ServletContext.getParameter(String).

    D.

    They can be accessed ...

Get Head First Servlets and JSP, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.