Skip to content

Latest commit

 

History

History
19 lines (16 loc) · 811 Bytes

File metadata and controls

19 lines (16 loc) · 811 Bytes

java_servlet

This snippet helped me practice Java Servlet concepts such as:

Java Servlet Architecture

Servlet Lifecycle

Servlet Methods

Servlet Collaboration

Servlet Attributes

Session Management

Session Lifecycle

alt-image _

The content type is a way for the server to communicate with the browser about the type of data being sent.

HelloServlet: I used .setContextType( ) method to specify the type of content that the browser should expect to receive. Alternatively, @RequestMapping could be used. For the types of the context:

  • "text/plain" for plain text content
  • "application/json" for JSON data
  • "image/jpeg" for JPEG images