Category Archives: Без рубрики

Java.Servlet.What are the different methods of session management in servlets?

✅ Session Management means tracking user interactions across multiple HTTP requests. Because: HTTP is stateless by design. Every HTTP request is independent — the server forgets everything about the previous request. So if you want a user to “stay logged … Continue reading

Posted in Без рубрики | Leave a comment

Java.Servlets.What happens to symbols when i don’t encode them in URL, give example ?

🧠 What Happens if You Don’t Encode Symbols in a URL? The browser or server may misinterpret your URL. Special symbols have specific meanings in URLs. If they are not properly encoded, they can break the URL structure or cause … Continue reading

Posted in Без рубрики | Leave a comment

Java.Servlets.What does URL encoding mean? How can it be implemented in Java?

🧠 What is URL Encoding? ✅ URL encoding is the process of translating special characters in a URL into a format that can be safely transmitted over the Internet. In URLs: Only letters, digits, and a few special characters (-, … Continue reading

Posted in Без рубрики | Leave a comment

Java.Servlet.Explain the SingleThreadModel interface.

🧠 What is SingleThreadModel? ✅ SingleThreadModel is an interface that was introduced in early Servlet API versions (Servlet 2.0) to guarantee that: Only one thread can execute the servlet’s service() method at a time per servlet instance. 🎯 How It … Continue reading

Posted in Без рубрики | Leave a comment

Java.Servlet.Can PrintWriter and ServletOutputStream be used simultaneously in a servlet?

❌ No, you cannot use both PrintWriter and ServletOutputStream simultaneously in a servlet for the same response. It is forbidden by the Servlet specification.Mixing them causes IllegalStateException. 🧠 Why? The response can either be character-based (PrintWriter) or byte-based (ServletOutputStream). Not … Continue reading

Posted in Без рубрики | Leave a comment

Java.Servlet.What is the difference between PrintWriter and ServletOutputStream?

Both are used to send data from your servlet back to the client as part of the HTTP response. But they are a little different: Feature PrintWriter ServletOutputStream Data type Character stream (text data) Byte stream (binary data) Best for … Continue reading

Posted in Без рубрики | Leave a comment

Java.Servlet.What is the difference between GET and POST?

🧠 Main Differences Between GET and POST Feature GET POST Where data is sent In the URL as query string (?key=value) In the HTTP request body Visibility Data is visible in the URL Data is hidden (not shown in URL) … Continue reading

Posted in Без рубрики | Leave a comment

Java.Servlet.What are the methods for sending data from the client to the server?

🧠 How Can a Client Send Data to the Server? There are several ways a client (like a browser or app) can send data to a server: 🎯 1. Using HTTP GET Parameters Data is sent in the URL as … Continue reading

Posted in Без рубрики | Leave a comment

Java.Servlets.Which HTTP method is not immutable?

🧠 First: What is an immutable HTTP method? In HTTP, a method is considered immutable (or safe) if: It does NOT change anything on the server. It’s supposed to be read-only (just retrieves data). ✅ Examples of immutable (safe) methods: … Continue reading

Posted in Без рубрики | Leave a comment

Java.Servlet.Should I worry about multithreaded safety when working with servlets?

The short answer is:👉 Yes, you absolutely should worry about thread safety when working with servlets. Let’s break this down very clearly: 🧠 Why? In a servlet container (like Tomcat, Jetty, etc.),only one instance of your servlet class is created … Continue reading

Posted in Без рубрики | Leave a comment