How to use External JSP files

Posted on 2006-05-12
Last Modified: 2008-02-26

 I am workin on a Jsp and html based webfront end. My problem is that i have this menu that is in every .jsp page and pages are like 20. Now if i need to change something in the menu i have to go manually in every file or page to change it.
Is there any way that i write the code in one file and create a link of that file in other pages just like you do with
External CSS files. Below is my code.
<script type="text/javascript">
function lite(obj) {
if(document.all&&!window.opera) {


This is the code that is on my index page and i need this code to be placed in one file so that if i have to change any thing , i just need to change it from one file.

<div id="header">

                <img src="img/z.gif" width ="50" height="35" align ="left">
                <img src="img/b.gif"    width ="50" height="35" align ="right">
                <div id ="heading"> *********** </div>
       <div id="menubar">
                          <li><a href="index.jsp" onmouseover="lite(this)" onmouseout="lite(this)">Home</a></li>
                          <li><a href="Volumetric.jsp" onmouseover="lite(this)" onmouseout="lite(this)">Volumetrics</a></li>
                          <li><a href="kea.jsp" onmouseover="lite(this)" onmouseout="lite(this)">Error Analysis</a></li>
                          <li><a href="graph.jsp" onmouseover="lite(this)" onmouseout="lite(this)">Graphing</a></li>
                          <li><a href="scorecard.jsp" onmouseover="lite(this)" onmouseout="lite(this)">Scorecard</a></li>
                          <li><a href="contacts.jsp" onmouseover="lite(this)" onmouseout="lite(this)">Contact</a></li>
                          <li><a href="help.jsp" onmouseover="lite(this)" onmouseout="lite(this)">Help</a></li>
                          <li><a href="credits.jsp" onmouseover="lite(this)" onmouseout="lite(this)">Credits</a></li>

Below is the code from the External CSS Sheets.

 width: 63em;
 background: #c0c0c0;

#menubar ul {

    margin: 0;
    padding: 0;
    list-style-type: none;

 #menubar li {
    margin: 1px 0 0;
   display: inline;

#menubar a {

padding: 5px 0px 10px 15px;
border: 3px solid white;
background: black;
text-decoration: none; /*lets remove the link underlines*/
color: white;
margin-left: -4;


 #menubar a:link,  #menubar a:active,  #menubar a:visited {
   font-size: 80%;
   font-family: lucida fax;
   font-weight: bold;
   color: white;

#menubar a:hover {
border: 1px solid #000000;
background: red;
color: white;

Please help asap
Question by:ammartahir1978
    LVL 3

    Accepted Solution

    all you need to do is to cut the menu code, put it in a new html page.
    Let s say that the new html page is called menu.html
    then you go to your html or jsp pages and you write the following link in place of the menu code:

    <!--#include file="menu.html"-->

    try it. it should work


    Author Comment

    cheers zeina it works.Now i can just modify code in one page and every other pages gets updated accordingly.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Microsoft Edge 9 69
    Is there an html code helper for wordpress? 2 45
    Effect on button 11 40
    format nvarchar field as mm/dd/yyyy 4 41
    Building “do-it-yourself” web sites has become an epidemic. There are so many blogs, web sites and even books that "teach" you how to build your web site in a few extremely simple and easy steps. Building a web site has become easier than boiling an…
    Read about why website design really matters in today's demanding market.
    Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now