Skip to content
Related Articles

Related Articles

Servlet – Server Side Include (SSI)

View Discussion
Improve Article
Save Article
  • Last Updated : 14 Feb, 2022
View Discussion
Improve Article
Save Article

Server-side includes are instructions and directives included in a web page that the web server may analyze when the page is provided. SSI refers to the servlet code that is embedded into the HTML code. Not all web servers can handle SSI. so you may read documents supported by a web server before utilizing SSI in your code.


<SERVLET CODE=MyGfgClassname CODEBASE=path initparam1=initparamvalue initparam2=initparam2value>
    <PARAM NAME=name1 VALUE=value1>
    <PARAM NAME=name2 VALUE=value2>

Here the path indicates the MyGfgClassname class name path in the server.  you can set up the remote file path also. the remote file path syntax is,


When a server that does not support SSI sees the SERVLET> tag while returning the page, it replaces it with the servlet’s output. The server does not parse all of the pages it returns; only those with a.shtml suffix are parsed. The class name or registered name of the servlet to invoke is specified by the code attributes. It’s not required to use the CODEBASE property. The servlet is presumed to be local without the CODEBASE attribute. The PARAM> element may be used to send any number of parameters to the servlet. The getParameter() function of ServletRequest may be used by the servlet to obtain the parameter values.

Server Side Include (SSI)




    Hello GEEKS, current time is:
    <!-- here the ssi servlet 
         class has been called-->
    <SERVLET CODE=GfgTime>


import java.text.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class GfgTime extends HttpServlet 
 private static final long serialVersionUID = 1L;
        public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException 
             PrintWriter out = res.getWriter();
             Date date = new Date();
             DateFormat df = DateFormat.getInstance();
             // Here write the response shtml file
             out.println("Hello GEEKS, current time is:");






My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!