0

I have a header.jsp file.I am including this file in the body of rest of the jsp pages i have. I want this header.jsp file to contain a script for showing current date/time(for example). I wrote the script ,but it didn't work. So, i had to include that script in every jsp page , where i have included that. but, that is not a good idea,i know. please suggest a way out.

header.jsp:

<div id="header">
        <img id="main_logo" src="<c:url value="/resources/Images/logo.png" />">

        <div id="move_right">
        <div id="login_img">            
            <img id="user_img" src="<c:url value="/resources/Images/userlogo.png" />">                          
        </div>
        <div id="login_info">
            <span id="username">Administrator</span>
            <br>
            <span id="date_time"></span>
            <br>
            <span id="logout">Log Out </span>
            <span id="help">Help</span>
        </div>
        </div>

the script that i want is:

$("#date_time").text(new Date($.now()));    

suppose the another jsp page :

    <body>
            <%@ include file="header.jsp" %>
 $(document).ready( function () {
            $("#date_time").text(new Date($.now()));
});
        </body>
edge
  • 257
  • 4
  • 20

0 Answers0