I am really desperate. I try to display the current date in a JSP
but that does not function. 
        I found many examples of Javascript (aff_heure()) on the Web but the
difficulty is to combine them with 
        the Struts components and more precisely Tiles components.
        Each page of the application has the same look: a header, a menu, a
body and a footer.
        And I have a main layout.jsp that each page has to extend:
        <html:html locale="true">
        <head>
                <title><tiles:getAsString name="title"/></title>
        </head>
        <body onload= "aff_heure()" bgcolor="#ffffff" text="#000000"
link="#023264" alink="#023264" vlink="#023264">
        <table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
                <td width="140"  valign="top" height="23"><tiles:insert
attribute="header"/></td>
                 <td width="100%" colspan="3"  align="left"><tiles:insert
attribute="menu"/></td>
          </tr>
          <tr>
                <td valign="top"  align="center"><tiles:insert
attribute='body' /> </td>
          </tr>
           <tr>
                <tiles:insert attribute="footer" />
           </tr>
        </table>
        </body>
        </html:html>
        In the header.jsp I have defined the aff_heure() script:

        <table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
                <script type="text/javascript">
                      function aff_heure() {
                          var d=new Date()
                              var weekday=new
Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"
)
                              var monthname=new
Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec
")
                              document.write(weekday[d.getDay()] + " ")
                          document.write(d.getDate() + ". ")
                          document.write(monthname[d.getMonth()] + " ")
                              document.write(d.getFullYear()+ ",")
                              document.write(d.getHours())
                              document.write(":")
                              document.write(d.getMinutes())        
                      document.write(":")
                      document.write(d.getSeconds())
                      setTimeout("aff_heure()",10000);
                }
                </script>
                <noscript><bean:message
key="label.javascript.required"/></noscript>
          </tr>
        </table>

        This code doesn't work, the page displayed only a number. 
         If somebody succeeded in posting the current date/time thank you
very much to indicate the solution to me 


----------------------------------------------------------------------------

As of February 12th, 2003 Thomson unifies its email addresses on a worldwide
basis. 
Please note my new email address: [EMAIL PROTECTED] 

http://www.thomson.net/ 

Reply via email to