Home Jsp Include Static HTML Page in JSP



Include Static HTML Page in JSP
Posted on: July 11, 2008 at 12:00 AM
This example shows how to include static html page in jsp.

Include Static HTML Page in JSP

     

This example shows how to include static html page in jsp.

In JSP, there are two ways to include another web resource.
1. include directive and 
2. jsp:include element.

Using include directive inserts text of another file and processed when the JSP is translated into a servlet class. So you can use include directive when any chunk of code is needed to be reused.

In this example <%@ include file="static.html" %> tag is used to include html page. The following includeStatic.jsp page shows the include tag.

includeStatic.jsp

<html>
  <head><title>Include Static Page</title></head>
  <body>
  <H2>Contents of html page display here:</H2>
  <%@ include file="static.html" %>
  </body>
</html>

Here is the html page "static.html" 

<html>
  <head><title>Static HTML Page</title></head>
  <body>
  <H3>This is the html page:</H3>
  <b><font color='blue'> My name is sandeep kumar suman</font></b><br>
  <b><font color='blue'> Roseindia Technology Pvt Ltd, New Delhi</font></b>
  </body>
</html>

Start Tomcat. Type the url: http://localhost:8080/ServletExample/jsp/includeStatic.jsp on your browser.

Following output will be displayed:

Download Source Code

Related Tags for Include Static HTML Page in JSP:
htmlcwebjspfileclasstextprocessstaticinsertincludeservletsedpagesourceusingresourceintthiselementjsshowtexreuseexampletoexamsseprocwsshexteildirectivetranslatenotcanuseceinnomlasstamnttrcaletjclesemdiragercmehowintoproxawhenxampsrectspsoeedirectessatanylatekinchtmisirinsertsivmplandarstatcodcodertrtsrvxttwslassrocthshostatieueupleplprocesprndodeo


More Tutorials from this section

Ask Questions?    Discuss: Include Static HTML Page in JSP   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.