Author Archives: Stanislav_Panteleev

Java.Servlet.JSP Request-to-Response Lifecycle

🔁 JSP Request-to-Response Lifecycle 1. Client Sends HTTP Request A user visits a URL like: This sends an HTTP GET (or POST) request to the web server. 3. JSP Is Translated into a Servlet If it’s the first time the … Continue reading →

Posted in Без рубрики | Comments Off on Java.Servlet.JSP Request-to-Response Lifecycle

Java.Servlet.Why do we need JSP?

✅ 1. Simplifies Web Development Instead of writing HTML inside Java (as in Servlets), you can write HTML first and just insert Java logic where needed. This makes your code: Easier to write Easier to read Easier to maintain ✅ … Continue reading →

Posted in Без рубрики | Comments Off on Java.Servlet.Why do we need JSP?

Java.Servlet.What are Java Server Pages (JSP)?

Java Server Pages (JSP) are server-side technologies used to create dynamic web pages by embedding Java code directly into HTML. JSPs are like HTML pages, but with the ability to run Java code inside them. The server compiles JSPs into … Continue reading →

Posted in Без рубрики | Comments Off on Java.Servlet.What are Java Server Pages (JSP)?

Java.Servlet.What authentication methods are available to a servlet?

✅ Short Answer: In servlets, there are four standard authentication methods, defined by the Servlet Specification (web.xml or annotations). Method Description 1. Basic Authentication Simple login popup from the browser (username/password sent base64-encoded). 2. Digest Authentication Like Basic but sends … Continue reading →

Posted in Без рубрики | Comments Off on Java.Servlet.What authentication methods are available to a servlet?

Java.Servlet.What are the main features introduced in the Servlet 3 specification?

✅ Short answer: Servlet 3.0 (finalized in December 2009, part of Java EE 6) brought major improvements to simplify development and support modern web applications. ✅ Main Features introduced in Servlet 3.0: Feature Description 1. Annotation-based Configuration No more messy … Continue reading →

Posted in Без рубрики | Comments Off on Java.Servlet.What are the main features introduced in the Servlet 3 specification?

Java.Servlet.Should i close connection in my code if i use connection pool ?

✅ Short and clear answer:YES, you absolutely must close the Connection yourself even when using a connection pool! BUT — and this is very important — Closing a connection from the pool does NOT physically close it to the database. … Continue reading →

Posted in Без рубрики | Comments Off on Java.Servlet.Should i close connection in my code if i use connection pool ?

Java.Servlet.If i created connection pool, when it should be destroyed ?

✅ Short answer:The connection pool (like HikariDataSource, Tomcat DataSource, etc.) should be destroyed when the web application is shutting down. That means: When Tomcat (or another servlet container) undeploys your app, Or stops, Or reloads the application. Otherwise: Database connections … Continue reading →

Posted in Без рубрики | Comments Off on Java.Servlet.If i created connection pool, when it should be destroyed ?

Java.Servlet.How can we organize a database connection, provide logging in a servlet?

✅ Problem: You need a database connection in your servlet. You want to log information, warnings, errors (instead of just printing to console). If you just open a Connection inside every servlet → it’s inefficient and dangerous (resource leaks, no … Continue reading →

Posted in Без рубрики | Comments Off on Java.Servlet.How can we organize a database connection, provide logging in a servlet?

Java.Servlet.How can we provide transport layer security for our web application?

✅ Short answer:To provide Transport Layer Security (TLS) for your web application, you must use HTTPS instead of HTTP. TLS = modern version of SSL (Secure Sockets Layer).It encrypts all the data sent between the client (browser) and server, preventing: … Continue reading →

Posted in Без рубрики | Comments Off on Java.Servlet.How can we provide transport layer security for our web application?

Java.Servlet.What is an effective way to ensure that all servlets are accessible only to a user with a valid session?

✅ Short answer:The most effective and standard way is to use a Servlet Filter. A Filter intercepts every request before it reaches the servlet. In the filter, you check if the user has a valid session. If the session is … Continue reading →

Posted in Без рубрики | Comments Off on Java.Servlet.What is an effective way to ensure that all servlets are accessible only to a user with a valid session?