Re: HELP: Dispaly Date in a JSP that used Tiles
You don't need to create an ActionForm, since the form is never going to be submitted, and you don't need to be able to access the form information outside of the current page. So just use plain html tags instead of the struts-html tags. Gareth. Heligon Sandra wrote: First, thanks a lot for your help. I think indeed that this manner of making is better but I have a problem to set up it. Because I must define a tag form. form name=myForm input type=text name=dateControl size=30 /form As I explained in my previous message I use Tiles all the pages are composed of several modules header, menu, body and footer. It is in the header module that I want to display the date, for the moment the header.jsp page is the following: %@ taglib uri=/WEB-INF/tld/struts-bean.tld prefix=bean % %@ taglib uri=/WEB-INF/tld/struts-html.tld prefix=html % form name=MyForm table border=0 width=100% cellspacing=0 cellpadding=0 tr td width=40 align=left bean:message key=label.project.version/ /td td width=80% align=right html:text name=MyForm property=dateControl size=30/ noscriptbean:message key=label.javascript.required//noscript /td /tr /table /form When I run the application I have an error no instance of MyForm has been created. I thus defined a DynaValidatorForm in struts-config.xml,and use the Struts tag html:form name=MyForm. But when I compile the application I have the following message action is mandatory for tag form. But I don't want to associate an action to this page. How can I do ? Thanks a lot in advance Sandra 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/ Original Message- From: Gareth Andrew [mailto:[EMAIL PROTECTED] Sent: 02 April 2003 00:49 To: [EMAIL PROTECTED] Subject: RE: HELP: Dispaly Date in a JSP that used Tiles I think your problem has nothing to do with tiles or jsp. You just need to write the output to a control instead of trying to write to the page. If the browser were to allow your code to work as you have written it you would actually get a list of times. The following code should work - it renders to a named textBox. BEGINNING OF CODE SAMPLE -- script type=text/javascript function aff_heure() { var d=new Date() var weekdays=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 ) var weekday=weekdays[d.getDay()] var date = d.getDate() var month = monthname[d.getMonth()] var year = d.getFullYear() var hour = d.getHours() var minute = d.getMinutes() var second = d.getSeconds() var time = new String(weekday + + date + . + month + + year + , + hour + : + minute + : + second) document.myForm.dateControl.value=time; setTimeout(aff_heure(),100); } /script form name=myForm input type=text name=dateControl size=30 /form END OF CODE SAMPLE -- Hope this helps, Gareth PS. You can also render to put your answer in other html objects such as spans and divs but if you're trying to make it work on as many browsers as possible that might be a bit of a headache. PPS. Why not use d.toGMTString() or d.toLocaleString() instead of trying to format the string yourself? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: HELP: Dispaly Date in a JSP that used Tiles
thank you for your answer but when you say just use plain html tags it is what I do with form name=MyForm isn't it ? But it doesn't work because when I run my application I have the error javax.servlet.ServletException: Cannot find bean myForm in any scope. Why ? With the plain html tag form, who is responsible for creation of the form instance ? 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/ Original Message- From: Gareth Andrew [mailto:[EMAIL PROTECTED] Sent: 02 April 2003 11:10 To: Struts Users Mailing List Subject: Re: HELP: Dispaly Date in a JSP that used Tiles You don't need to create an ActionForm, since the form is never going to be submitted, and you don't need to be able to access the form information outside of the current page. So just use plain html tags instead of the struts-html tags. Gareth. Heligon Sandra wrote: First, thanks a lot for your help. I think indeed that this manner of making is better but I have a problem to set up it. Because I must define a tag form. form name=myForm input type=text name=dateControl size=30 /form As I explained in my previous message I use Tiles all the pages are composed of several modules header, menu, body and footer. It is in the header module that I want to display the date, for the moment the header.jsp page is the following: %@ taglib uri=/WEB-INF/tld/struts-bean.tld prefix=bean % %@ taglib uri=/WEB-INF/tld/struts-html.tld prefix=html % form name=MyForm table border=0 width=100% cellspacing=0 cellpadding=0 tr td width=40 align=left bean:message key=label.project.version/ /td td width=80% align=right html:text name=MyForm property=dateControl size=30/ noscriptbean:message key=label.javascript.required//noscript /td /tr /table /form When I run the application I have an error no instance of MyForm has been created. I thus defined a DynaValidatorForm in struts-config.xml,and use the Struts tag html:form name=MyForm. But when I compile the application I have the following message action is mandatory for tag form. But I don't want to associate an action to this page. How can I do ? Thanks a lot in advance Sandra --- - 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/ Original Message- From: Gareth Andrew [mailto:[EMAIL PROTECTED] Sent: 02 April 2003 00:49 To: [EMAIL PROTECTED] Subject: RE: HELP: Dispaly Date in a JSP that used Tiles I think your problem has nothing to do with tiles or jsp. You just need to write the output to a control instead of trying to write to the page. If the browser were to allow your code to work as you have written it you would actually get a list of times. The following code should work - it renders to a named textBox. BEGINNING OF CODE SAMPLE -- script type=text/javascript function aff_heure() { var d=new Date() var weekdays=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 ) var weekday=weekdays[d.getDay()] var date = d.getDate() var month = monthname[d.getMonth()] var year = d.getFullYear() var hour = d.getHours() var minute = d.getMinutes() var second = d.getSeconds() var time = new String(weekday + + date + . + month + + year + , + hour + : + minute + : + second) document.myForm.dateControl.value=time; setTimeout(aff_heure(),100); } /script form name=myForm input type=text name=dateControl size=30 /form END OF CODE SAMPLE -- Hope this helps, Gareth PS. You can also render to put your answer in other html objects such as spans and divs but if you're trying to make it work on as many browsers as possible that might be a bit of a headache. PPS. Why not use d.toGMTString() or d.toLocaleString() instead of trying to format the string yourself? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: HELP: Dispaly Date in a JSP that used Tiles
Yup, the error is coming from html:text name=MyForm property=dateControl size=30/ as it is looking for a FormBean called MyForm. Instead use: input type=text name=dateControl size=30/ Heligon Sandra wrote: thank you for your answer but when you say just use plain html tags it is what I do with form name=MyForm isn't it ? But it doesn't work because when I run my application I have the error javax.servlet.ServletException: Cannot find bean myForm in any scope. Why ? With the plain html tag form, who is responsible for creation of the form instance ? 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/ Original Message- From: Gareth Andrew [mailto:[EMAIL PROTECTED] Sent: 02 April 2003 11:10 To: Struts Users Mailing List Subject: Re: HELP: Dispaly Date in a JSP that used Tiles You don't need to create an ActionForm, since the form is never going to be submitted, and you don't need to be able to access the form information outside of the current page. So just use plain html tags instead of the struts-html tags. Gareth. Heligon Sandra wrote: First, thanks a lot for your help. I think indeed that this manner of making is better but I have a problem to set up it. Because I must define a tag form. form name=myForm input type=text name=dateControl size=30 /form As I explained in my previous message I use Tiles all the pages are composed of several modules header, menu, body and footer. It is in the header module that I want to display the date, for the moment the header.jsp page is the following: %@ taglib uri=/WEB-INF/tld/struts-bean.tld prefix=bean % %@ taglib uri=/WEB-INF/tld/struts-html.tld prefix=html % form name=MyForm table border=0 width=100% cellspacing=0 cellpadding=0 tr td width=40 align=left bean:message key=label.project.version/ /td td width=80% align=right html:text name=MyForm property=dateControl size=30/ noscriptbean:message key=label.javascript.required//noscript /td /tr /table /form When I run the application I have an error no instance of MyForm has been created. I thus defined a DynaValidatorForm in struts-config.xml,and use the Struts tag html:form name=MyForm. But when I compile the application I have the following message action is mandatory for tag form. But I don't want to associate an action to this page. How can I do ? Thanks a lot in advance Sandra --- - 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/ Original Message- From: Gareth Andrew [mailto:[EMAIL PROTECTED] Sent: 02 April 2003 00:49 To: [EMAIL PROTECTED] Subject: RE: HELP: Dispaly Date in a JSP that used Tiles I think your problem has nothing to do with tiles or jsp. You just need to write the output to a control instead of trying to write to the page. If the browser were to allow your code to work as you have written it you would actually get a list of times. The following code should work - it renders to a named textBox. BEGINNING OF CODE SAMPLE -- script type=text/javascript function aff_heure() { var d=new Date() var weekdays=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 ) var weekday=weekdays[d.getDay()] var date = d.getDate() var month = monthname[d.getMonth()] var year = d.getFullYear() var hour = d.getHours() var minute = d.getMinutes() var second = d.getSeconds() var time = new String(weekday + + date + . + month + + year + , + hour + : + minute + : + second) document.myForm.dateControl.value=time; setTimeout(aff_heure(),100); } /script form name=myForm input type=text name=dateControl size=30 /form END OF CODE SAMPLE -- Hope this helps, Gareth PS. You can also render to put your answer in other html objects such as spans and divs but if you're trying to make it work on as many browsers as possible that might be a bit of a headache. PPS. Why not use d.toGMTString() or d.toLocaleString() instead of trying to format the string yourself? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED
RE: HELP: Dispaly Date in a JSP that used Tiles
Thank you very much for this explanation I have finally a solution which goes, after such an amount of time that given pleasure. I still have nevertheless a very small problem. I would like to post the date like a label I don't want that the user can edit it. Is this possible? by what can I replace the tag input type=text name=dateControl size=30/. My JSP: form name=myForm table border=0 width=100% cellspacing=0 cellpadding=0 td width=40 align=left bean:message key=label.xms.version/: bean:message key=xms.version.value/ /td td width=80% align=right input type=text name=dateControl size=30/ script TYPE=text/javascript function aff_heure(){ var d=new Date(); var weekdays=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); var weekday=weekdays[d.getDay()]; var date = d.getDate(); var month = monthname[d.getMonth()]; var year = d.getFullYear(); var hour = d.getHours(); var minute = d.getMinutes(); var second = d.getSeconds(); var time = new String(weekday + + date + . + month + + year + , + hour + : + minute + : + second); document.myForm.dateControl.value=time; setTimeout(aff_heure(),100); } aff_heure(); /script /td /tr /table Thanks a lot in advance. 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/ Original Message- From: Gareth Andrew [mailto:[EMAIL PROTECTED] Sent: 02 April 2003 13:06 To: Struts Users Mailing List Subject: Re: HELP: Dispaly Date in a JSP that used Tiles Yup, the error is coming from html:text name=MyForm property=dateControl size=30/ as it is looking for a FormBean called MyForm. Instead use: input type=text name=dateControl size=30/ Heligon Sandra wrote: thank you for your answer but when you say just use plain html tags it is what I do with form name=MyForm isn't it ? But it doesn't work because when I run my application I have the error javax.servlet.ServletException: Cannot find bean myForm in any scope. Why ? With the plain html tag form, who is responsible for creation of the form instance ? --- - 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/ Original Message- From: Gareth Andrew [mailto:[EMAIL PROTECTED] Sent: 02 April 2003 11:10 To: Struts Users Mailing List Subject: Re: HELP: Dispaly Date in a JSP that used Tiles You don't need to create an ActionForm, since the form is never going to be submitted, and you don't need to be able to access the form information outside of the current page. So just use plain html tags instead of the struts-html tags. Gareth. Heligon Sandra wrote: First, thanks a lot for your help. I think indeed that this manner of making is better but I have a problem to set up it. Because I must define a tag form. form name=myForm input type=text name=dateControl size=30 /form As I explained in my previous message I use Tiles all the pages are composed of several modules header, menu, body and footer. It is in the header module that I want to display the date, for the moment the header.jsp page is the following: %@ taglib uri=/WEB-INF/tld/struts-bean.tld prefix=bean % %@ taglib uri=/WEB-INF/tld/struts-html.tld prefix=html % form name=MyForm table border=0 width=100% cellspacing=0 cellpadding=0 tr td width=40 align=left bean:message key=label.project.version/ /td td width=80% align=right html:text name=MyForm property=dateControl size=30/ noscriptbean:message key=label.javascript.required//noscript /td /tr /table /form When I run the application I have an error no instance of MyForm has been created. I thus defined a DynaValidatorForm in struts-config.xml,and use the Struts tag html:form name=MyForm. But when I compile the application I have the following message action is mandatory for tag form. But I don't want to associate an action to this page. How can I do ? Thanks a lot in advance Sandra -- - - 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
Re: HELP: Dispaly Date in a JSP that used Tiles
It's about now I have to admit that my Javascript/DHTML knowledge is about 4 years out of date. I have no idea how many browsers that this will work on, but it does seem to work on IE6.0 and Mozilla 1.3: In your script replace: document.myForm.dateControl.value=time; with document.getElementById(dateControl2).innerHTML=time; and in your html/jsp replace : form name=myForm input type=text name=dateControl size=30 readonly=true /form with span id=dateControl2/span Good luck, Gareth Heligon Sandra wrote: Thank you very much for this explanation I have finally a solution which goes, after such an amount of time that given pleasure. I still have nevertheless a very small problem. I would like to post the date like a label I don't want that the user can edit it. Is this possible? by what can I replace the tag input type=text name=dateControl size=30/. My JSP: form name=myForm table border=0 width=100% cellspacing=0 cellpadding=0 td width=40 align=left bean:message key=label.xms.version/: bean:message key=xms.version.value/ /td td width=80% align=right input type=text name=dateControl size=30/ script TYPE=text/javascript function aff_heure(){ var d=new Date(); var weekdays=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); var weekday=weekdays[d.getDay()]; var date = d.getDate(); var month = monthname[d.getMonth()]; var year = d.getFullYear(); var hour = d.getHours(); var minute = d.getMinutes(); var second = d.getSeconds(); var time = new String(weekday + + date + . + month + + year + , + hour + : + minute + : + second); document.myForm.dateControl.value=time; setTimeout(aff_heure(),100); } aff_heure(); /script /td /tr /table Thanks a lot in advance. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: HELP: Dispaly Date in a JSP that used Tiles
I'm not sure what you mean. Perhaps if you e-mail me your code I could take a quick look at it. Gareth. Heligon Sandra wrote: Your Javascript/DHTML knowledge knowledge is very good, your code allows to display the date like a text and not like a field that can be edited. But I have yet a problem, with this code some controls (not all) of my form do not stop moving. what is this has? contrary to you my JavaScript knowledge is really basic. Thanks in advance - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: HELP: Dispaly Date in a JSP that used Tiles
Here is the result of my page when I do view source: html lang=en head titleLogin page/title /head body bgcolor=#ff text=#00 link=#023264 alink=#023264 vlink=#023264 table border=0 width=100% cellspacing=0 cellpadding=0 tr form name=dateForm table border=0 width=100% cellspacing=0 cellpadding=0 tr td width=40 align=leftProduct version:1.0/td td width=80% align=right noscriptThis page needs JavaScript!/noscript span id=dateControl/span script src=./scripts/clock.js/script scriptaff_heure();/script /td /tr /table /form /tr tr td valign=top align=center form name=loginForm method=post action=/login.do table bgcolor=#FF align=center cellspacing=0 cellpadding=4 border=0width=100% tr valign=top align=left td align=center width=30%bUsername/b/td td align=left width=30%input type=text name=userName value= /td td width=40%/td /tr tr valign=top align=left td align=center width=30%bPassword/b /td td align=left width=30%input type=password name=password value=nbsp input type=submit value=Login /td td width=40%/td /tr /table /form /td /tr /table /body /html The JavaScript (clock.js file) used is the following: function aff_heure(){ var d=new Date(); var weekdays=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 ); var weekday=weekdays[d.getDay()]; var date = d.getDate(); var month = monthname[d.getMonth()]; var year = d.getFullYear(); var hour = d.getHours(); var minute = d.getMinutes(); var second = d.getSeconds(); var time = new String(weekday + + date + . + month + + year + , + hour + : + minute + : + second); //document.dateForm.dateControl.value=time; //This instruction allows to display date like a lable and not a field that can //be edited. But it dosen't work very well. document.getElementById(dateControl).innerHTML=time; setTimeout(aff_heure(),100); } The date can not be modified by the user but some control like the button login flickers. 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/ Original Message- From: Gareth Andrew [mailto:[EMAIL PROTECTED] Sent: 02 April 2003 17:36 To: Struts Users Mailing List Subject: Re: HELP: Dispaly Date in a JSP that used Tiles I'm not sure what you mean. Perhaps if you e-mail me your code I could take a quick look at it. Gareth. Heligon Sandra wrote: Your Javascript/DHTML knowledge knowledge is very good, your code allows to display the date like a text and not like a field that can be edited. But I have yet a problem, with this code some controls (not all) of my form do not stop moving. what is this has? contrary to you my JavaScript knowledge is really basic. Thanks in advance - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: HELP: Dispaly Date in a JSP that used Tiles
I think your problem has nothing to do with tiles or jsp. You just need to write the output to a control instead of trying to write to the page. If the browser were to allow your code to work as you have written it you would actually get a list of times. The following code should work - it renders to a named textBox. BEGINNING OF CODE SAMPLE -- script type=text/javascript function aff_heure() { var d=new Date() var weekdays=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) var weekday=weekdays[d.getDay()] var date = d.getDate() var month = monthname[d.getMonth()] var year = d.getFullYear() var hour = d.getHours() var minute = d.getMinutes() var second = d.getSeconds() var time = new String(weekday + + date + . + month + + year + , + hour + : + minute + : + second) document.myForm.dateControl.value=time; setTimeout(aff_heure(),100); } /script form name=myForm input type=text name=dateControl size=30 /form END OF CODE SAMPLE -- Hope this helps, Gareth PS. You can also render to put your answer in other html objects such as spans and divs but if you're trying to make it work on as many browsers as possible that might be a bit of a headache. PPS. Why not use d.toGMTString() or d.toLocaleString() instead of trying to format the string yourself? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: HELP: Dispaly Date in a JSP that used Tiles
First, thanks a lot for your help. I think indeed that this manner of making is better but I have a problem to set up it. Because I must define a tag form. form name=myForm input type=text name=dateControl size=30 /form As I explained in my previous message I use Tiles all the pages are composed of several modules header, menu, body and footer. It is in the header module that I want to display the date, for the moment the header.jsp page is the following: %@ taglib uri=/WEB-INF/tld/struts-bean.tld prefix=bean % %@ taglib uri=/WEB-INF/tld/struts-html.tld prefix=html % form name=MyForm table border=0 width=100% cellspacing=0 cellpadding=0 tr td width=40 align=left bean:message key=label.project.version/ /td td width=80% align=right html:text name=MyForm property=dateControl size=30/ noscriptbean:message key=label.javascript.required//noscript /td /tr /table /form When I run the application I have an error no instance of MyForm has been created. I thus defined a DynaValidatorForm in struts-config.xml,and use the Struts tag html:form name=MyForm. But when I compile the application I have the following message action is mandatory for tag form. But I don't want to associate an action to this page. How can I do ? Thanks a lot in advance Sandra 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/ Original Message- From: Gareth Andrew [mailto:[EMAIL PROTECTED] Sent: 02 April 2003 00:49 To: [EMAIL PROTECTED] Subject: RE: HELP: Dispaly Date in a JSP that used Tiles I think your problem has nothing to do with tiles or jsp. You just need to write the output to a control instead of trying to write to the page. If the browser were to allow your code to work as you have written it you would actually get a list of times. The following code should work - it renders to a named textBox. BEGINNING OF CODE SAMPLE -- script type=text/javascript function aff_heure() { var d=new Date() var weekdays=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 ) var weekday=weekdays[d.getDay()] var date = d.getDate() var month = monthname[d.getMonth()] var year = d.getFullYear() var hour = d.getHours() var minute = d.getMinutes() var second = d.getSeconds() var time = new String(weekday + + date + . + month + + year + , + hour + : + minute + : + second) document.myForm.dateControl.value=time; setTimeout(aff_heure(),100); } /script form name=myForm input type=text name=dateControl size=30 /form END OF CODE SAMPLE -- Hope this helps, Gareth PS. You can also render to put your answer in other html objects such as spans and divs but if you're trying to make it work on as many browsers as possible that might be a bit of a headache. PPS. Why not use d.toGMTString() or d.toLocaleString() instead of trying to format the string yourself? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: HELP: Dispaly Date in a JSP that used Tiles
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: ); 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 titletiles:getAsString name=title//title /head body onload= aff_heure() bgcolor=#ff text=#00 link=#023264 alink=#023264 vlink=#023264 table border=0 width=100% cellspacing=0 cellpadding=0 tr td width=140 valign=top height=23tiles:insert attribute=header//td td width=100% colspan=3 align=lefttiles:insert attribute=menu//td /tr tr td valign=top align=centertiles: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(),1); } /script noscriptbean: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]
Re: HELP: Dispaly Date in a JSP that used Tiles
ah sorry missed your timer function On Tuesday 01 April 2003 8:41 am, Stephen Smithstone wrote: 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: ); 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 titletiles:getAsString name=title//title /head body onload= aff_heure() bgcolor=#ff text=#00 link=#023264 alink=#023264 vlink=#023264 table border=0 width=100% cellspacing=0 cellpadding=0 tr td width=140 valign=top height=23tiles:insert attribute=header//td td width=100% colspan=3 align=lefttiles:insert attribute=menu//td /tr tr td valign=top align=centertiles: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,Saturd ay ) 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(),1); } /script noscriptbean: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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: HELP: Dispaly Date in a JSP that used Tiles
in respect to that dont you need to implement the date text into a text box container ? On Tuesday 01 April 2003 8:43 am, Stephen Smithstone wrote: ah sorry missed your timer function On Tuesday 01 April 2003 8:41 am, Stephen Smithstone wrote: 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: ); 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 titletiles:getAsString name=title//title /head body onload= aff_heure() bgcolor=#ff text=#00 link=#023264 alink=#023264 vlink=#023264 table border=0 width=100% cellspacing=0 cellpadding=0 tr td width=140 valign=top height=23tiles:insert attribute=header//td td width=100% colspan=3 align=lefttiles:insert attribute=menu//td /tr tr td valign=top align=centertiles: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,Satu rd ay ) 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(),1); } /script noscriptbean: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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]