Learn Java and Programming through articles, code examples, and tutorials for developers of all levels.
Difference between ServletConfig and ServletContext in JSP Servlet? Answer
Difference between include directive, include action and JSTL import tag in JSP? Answer
include directive
JSP include action
and JSTL import tag
The include directive provides static inclusion. It adds the content of the resource specified by its file attribute, which could be HTML, JSP, or any other resource at translation time.
Any change you make in the file to be included after JSP is translated will not be picked up by the include directive.
Top 5 Free Servlet, JSP, Java FX, and JDBC Courses for Java Web Developers in 2025 - Best of Lot
How to escape HTML Special characters in JSP and Java? Example
Difference between include() and forward() methods of RequestDispatcher in Servlert
6 Difference between forward() and sendRedirect() in Servlet - Answer
java.lang.IllegalStateException: getOutputStream() has already been called for this response
org.apache.jasper.JasperException: java.lang.IllegalStateException: getOutputStream() has already been called for this response
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:502)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:424)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
HelloServlet.doGet(HelloServlet.java:25)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
and here is the root cause :
How to fix java.lang.IllegalStateException: getWriter() has already been called for this response [Solution]
Difference between jsp:include and jsp:forward action- Example
<jsp:forward page="URL" />
6 Difference between include directive and include action in JSP
Even though both include directive and include action allows you to include the response of one JSP into another, they are quite different from each other e.g. include directive is processed at translation time and used to include the static resources e.g. HTML files, images, and CSS, etc, while the <jsp:include> action is processed at request time and used to include more dynamic resources e.g. JSP or Servlet. What is the difference between include directive and include action is also one of the most popular JSP interview questions, mostly asked either at telephonic round or first few round of Java web developer interviews?
Top 12 Servlet JSP Interview Questions for Java JEE Developers
Difference between GenericServlet vs HttpServlet in Servlet JSP - J2EE question
Top 40 Java and Linux Interview Questions Answers for IT Support Engineers
How to create a custom tag in JSP? Steps and Example
You can create a custom tag in JSP either by implementing the SimpleTag interface or extending SimpleTagSupport class. Custom tags are introduced in JSP 2.0 in an effort to minimize Java code from JSP to keep them maintainable and allow page authors to work more in HTML or XML, like environment than writing Java codes. SimpleTag and SimpleTagSupport allow you to create a custom tag in JSP. It's easier to start with SimpleTagSupport class because it implements all methods of the SimpleTagSupport interface and if you are writing a basic tag then you just need to override the doTag() method of this class.
9 JSP Implicit Objects and When to Use Them
If you are new to JSP then your first question would be what are implicit objects in JSP? Well, implicit objects in JSP are Java object which is created by Servlet containers like the tomcat or Jetty during translation phase of JSP, when JSP is converted to Servlet. These objects are created as local variables inside the service() method generated by the container. The most important thing about the implicit objects is to remember that these objects are available to any JSP developer inside the JSP page and they can do a lot of things with implicit objects and expression language which was only possible with scriptlet earlier. That's why they are known as implicit objects.