struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Heligon Sandra <sandra.heli...@nextream.fr>
Subject RE: Tiles - Date JavaScript problem
Date Mon, 21 Oct 2002 08:56:55 GMT
I tried to do the following:
Declaration of the JavaScript before the body, and call of the method
aff_heure()
in the date Tiles. But the date is not displayed and my application does not
respond.
I can do nothing. 

<html:html locale="true">
<head>
  <title><tiles:getAsString name="title"/></title>
</head>

<script type="text/javascript">
  var timerID = 0;
  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())

        timerID = setTimeout("aff_heure()",1000);
  }
</script>

<body bgcolor="#ffffff" text="#000000" link="#023264" alink="#023264"
vlink="#023264">

<table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
    <%-- Begin Logo --%>
    <td width="140"  valign="top" height="23"><tiles:insert
attribute="header"/></td>
    <%-- Begin Menu --%>
    <td width="100%" colspan="3"  align="left"><tiles:insert
attribute="menu"/></td>
  </tr>
  <tr>
    <tiles:insert attribute="date"/>
  </tr>
</table>

And the date Tiles points on:
<table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
    <td width="40"  align="left"><bean:message
key="label.XMS.version"/>:</td>
    <td width="80%" align="right">
      <script type="text/javascript">
      aff_heure();
      </script>
      <noscript><bean:message key="label.javascript.required"/></noscript>
    </td>
  </tr>
</table>


-----Original Message-----
From: Cedric Dumoulin [mailto:cedric@apache.org]
Sent: 18 October 2002 10:31
To: Struts Users Mailing List
Subject: Re: Tiles - Date JavaScript problem



  Hi,

  Yes it is.
  Remind that Tiles propose a way to build a page by assembling small 
pieces. The build is done on the server side, then the resulting page is 
sent to the client who interprets it. A javascript code is usually 
interpreted on the client side.
  In your case, you should take care the the method declaration happen 
before the method call in the resulting page. So, you need to insert the 
date Tiles before the <body ...> declaration.

        Cedric

Heligon Sandra wrote:

>	I need to display on each page of my application the current
>date-time.
>	I use the following JavaScript:
>	
>	<script type="text/javascript">
>      	      var timerID = 0;
>	      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","De
c
>")
>	        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())
>	        timerID = setTimeout("aff_heure()",1000);
>	      }
>	</script>
>
>	I placed this code in a file date.jsp
>
>	and when I defined my tiles I included this attribute:
>	<definition name="site.mainLayout"
>path="/tiles/layouts/classicLayout.jsp">
>	  <put name="title" value="Tiles Blank Site" />
>	  <put name="header" value="/tiles/common/header.jsp" />
>	  <put name="menu" value="site.menu.bar" />
>              <put name="date" value="/tiles/common/date.jsp" />
>             </definition>
>
>	To sart the aff_heure() it is said to do
>	<body onload="aff_heure()">
>
>	but when I do that in the classicLayout.jsp page, only one number
>(minute or second) is displayed,
>	and not all the page.
>
>	Is it possible to use JavaScript with Tiles ?
>
>	Thanks in advance
>	Sandra  
>	
>	 
>
>--
>To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>
>
>
>  
>


--
To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message