Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Jsp Include Static HTML Page in JSP

Related Tutorials


 
 

Share on Google+Share on Google+

Include Static HTML Page in JSP

Advertisement
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

Advertisements

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: July 11, 2008

Related Tutorials

Discuss: Include Static HTML Page in JSP   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:1
anantha lakshmi.m
December 23, 2012
hi

i want basic cncpts of jsp to create web pages
DMCA.com