How-to articles, tricks, and solutions about SERVLETS

doGet and doPost in Servlets

doGet and doPost are methods of the javax.servlet.http.HttpServlet class that are used to handle HTTP GET and POST requests, respectively.

Get the POST request body from HttpServletRequest

To get the POST request body from an HttpServletRequest object in Java, you can use the getReader method of the ServletRequest interface to read the request body as a BufferedReader and then use the readLine method to read the data as a string.

How can I upload files to a server using JSP/Servlet?

To upload files to a server using JSP/Servlet, you can use the following steps:

How do I import the javax.servlet / jakarta.servlet API in my Eclipse project?

To import the javax.servlet or jakarta.servlet API in an Eclipse project, follow these steps:

How do you return a JSON object from a Java Servlet

To return a JSON object from a Java Servlet, you can use the following steps:

How to solve javax.net.ssl.SSLHandshakeException Error?

The javax.net.ssl.SSLHandshakeException error is usually caused by a problem with the SSL/TLS certificate of the server you are trying to connect to.

HttpServletRequest get JSON POST data

To get JSON POST data from an HttpServletRequest object in Java, you can use the getReader method of the ServletRequest interface to read the request body as a BufferedReader and then use the readLine method to read the data as a string.

The import javax.servlet can't be resolved

If you are getting the error "The import javax.servlet can't be resolved", it means that the javax.servlet package is not available on the classpath.

What is the difference between JSF, Servlet and JSP?

JavaServer Faces (JSF) is a user interface (UI) framework for building web applications.