wow all that trouble for a date what i would do is create a TileAction that sets up the date variable in the tiles context and then publish that attribute on the tiles page
public class TilesDate extends TileAction { public void perform( ComponentContext 1 , HttpServletRequest 2 , HttpServletResponse 3 , ServletContext 4 ) { SimpleDateFormat sdf = new SimpleDateFormat( "dd:MM:yyyy" ); 1.putAttribute( "date" , sdf.format( new java.util.Date( ) ); } then in my tiles-def.xml i would have <definition controllerUrl="/TilesDate.do" name="portal.main" page="/layouts/layout1.jsp"> </definition> in the struts-config define the TilesDate actionMapping then call my tiles from an action forward using portal.main thats just my view thou On Tuesday 01 April 2003 8:33 am, Heligon Sandra wrote: > 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","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()) > 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/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]