Karten 62 Karten
Lernende 1 Lernende
Sprache English
Stufe Andere
Erstellt / Aktualisiert 12.09.2017 / 04.10.2017
Lizenzierung Keine Angabe     (Fabrizi)
0 Exakte Antworten 62 Text Antworten 0 Multiple Choice Antworten
Fenster schliessen

Which interface(s) do HttpServletRequest and HttpServletResponse
(inside javax.servlet.http package) extend?

ServletRequest and ServletResponse
(inside javax.servlet package)

Fenster schliessen

Which HTTP-methods are idempotent and what does that mean?


It means, they can be executed more than once without side-effects.

Fenster schliessen

Which HTTP-method will be used by the following form?

<form action="Servlet.do">...</form>

GET (default, if not specified explicitely by method="POST")

Fenster schliessen

By which methods can one form parameter or several checkbox parameters
be retrieved from the request object inside a servlet class?

String A = request.getParameter("paramA");

String[] B = request.getParameterValues("paramsB");

Fenster schliessen

What do the eight HTTP methods basically do?

  • GET: Ask for a resource
  • POST: Ask for a resource while transmitting body data
  • HEAD: Ask for only the Header
  • PUT: Ask to put the body info to requested URL
  • DELETE: Ask to delete the resource
  • CONNECT: Ask to connect for tunneling
  • OPTIONS: Ask for a list of all valid HTTP methods
  • TRACE: Ask for a copy of what's been received
Fenster schliessen

How can both GET- and POST-requests be supported
from one single servlet?

Put the logic into doGet() and delegate calls for doPost() to doGet():

public void doPost(...) throws ... {
request, response);

Fenster schliessen

How can an output stream be prepared to send
HTML-content or a .jar-file from a servlet?



Fenster schliessen

How can a String (like "<body>Hello</body>")
or a byte-Array
be returned from a servlet?

PrintWriter writer = response.getWriter();

ServletOutputStream out = response.getOutputStream();