Category: java
Jsp directives and implicit objects
Published on 30 Sep 2026
Explanation
JSP directives provide instructions to the JSP container about how the page should be processed.
Code:
<%@ page contentType="text/html" %>
Explanation
The include directive includes another JSP or static resource during JSP translation.
Code:
<%@ include file="header.jsp" %> <h1>Home Page</h1> <%@ include file="footer.jsp" %>
Explanation
The taglib directive declares a tag library such as JSTL for use inside a JSP page.
Code:
<%@ taglib prefix="c"
uri="jakarta.tags.core" %>
Explanation
JSP provides implicit objects such as request, response, session, application, out, and exception.
Code:
request response session application out pageContext config page exception
Explanation
Implicit objects allow JSP pages to access request data, session data, application data, and response output.
Code:
Welcome ${sessionScope.username}
Request URI:
<%= request.getRequestURI() %>