RE: HELP: Dispaly Date in a JSP that used Tiles

2003-04-02 Thread Heligon Sandra

Here is the result of my page when I do view source:



  Login page




 


  
Product version:1.0

  This page needs JavaScript!
  
   
  aff_heure();

  


 
 

  



  Username
   


  
Password

   
   

  
  
  








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

2003-04-02 Thread Gareth Andrew
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

2003-04-02 Thread Heligon Sandra
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




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 15:45
To: Struts Users Mailing List
Subject: 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 :




with



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 name="dateControl" size="30"/>.
>
>My JSP:
>
>
>
>   :
>   
>
>
>  
>
>   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();
>  
>
>  
>
>
>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

2003-04-02 Thread Gareth Andrew
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 :

   

with



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 
name="dateControl" size="30"/>.

My JSP:


   
	:
	
   
   
 
   
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();
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

2003-04-02 Thread Heligon Sandra
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 .

My JSP:



:



  

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();
  

  


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

  

as it is looking for a FormBean called MyForm.
Instead use:




Heligon Sandra wrote:

>thank you for your answer but when you say "just use plain html tags"
>it is what I do with   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. 
>>
>>   
>>
>>
>>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" %>
>>
>>
>>
>> 
>>   
>>   
>>   
>>   
>>  
>>
>>   
>> 
>>
>>
>>
>>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
>>. 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
>>
>>
>>--
-
>>
>

Re: HELP: Dispaly Date in a JSP that used Tiles

2003-04-02 Thread Gareth Andrew
Yup, the error is coming from

  

as it is looking for a FormBean called MyForm.
Instead use:


Heligon Sandra wrote:

thank you for your answer but when you say "just use plain html tags"
it is what I do with   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. 

  


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" %>



  

  
  
 
   
  




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
. 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 --

<br>
 function aff_heure() {<br>
  var d=new Date()<br>
  var weekdays=new 
Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday<br>
   </tt><br>
<br>
</blockquote><tt>"<br>
 </tt><br>
<br>
<blockquote style="border-left: #FF solid 0.1em; margin: 0em; padding-left: 1.0em"><tt>)<br>
  var monthname=new 
Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","De<br>
   </tt><br>
<br>
</blockquote><tt>c<br>
 </tt><br>
<br>
<blockquote style="border-left: #FF solid 0.1em; margin: 0em; padding-left: 1.0em"><tt>")</tt><br>
<br>
<tt>   var weekday=weekdays[d.getDay()]<br>
   var date = d.getDate()<br>
   var month = monthname[d.getMonth()]<br>
  var year = d.getFullYear()<br>
  var hour = d.getHours()<br>
  var minute = d.getMinutes()<br>
  var second = d.getSeconds()<br>
   
   var time = new String(weekday + " " + date<br>
+ "." + month + " " + year<br>
+ ", " + hour + ":" + minute<br>
+ ":" + second)<br>
   document.myForm.dateControl.value=time;</tt><br>
<br>
<tt> 
  setTimeout("aff_heure()",100);<br>
 }</tt><br>
<br>
<tt>


  

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]
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: HELP: Dispaly Date in a JSP that used Tiles

2003-04-02 Thread Heligon Sandra
thank you for your answer but when you say "just use plain html tags"
it is what I do with   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. 
>
>
>
>
>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" %>
>
>
>
>  
>
>
>
>
>   
> 
>
>  
>
>
>
>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
>. 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 --
>
>
>   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);
>   }
>  
>
>
>
>
>
>
>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

2003-04-02 Thread Gareth Andrew
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. 

   


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" %>


 
   

   
   
  

   
 



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
. 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 --

<br>
  function aff_heure() {<br>
   var d=new Date()<br>
   var weekdays=new 
Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"<br>
)<br>
   var monthname=new 
Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec<br>
")</tt><br>
<br>
<tt>var weekday=weekdays[d.getDay()]<br>
var date = d.getDate()<br>
var month = monthname[d.getMonth()]<br>
   var year = d.getFullYear()<br>
   var hour = d.getHours()<br>
   var minute = d.getMinutes()<br>
   var second = d.getSeconds()<br>

var time = new String(weekday + " " + date<br>
 + "." + month + " " + year<br>
 + ", " + hour + ":" + minute<br>
 + ":" + second)<br>
document.myForm.dateControl.value=time;</tt><br>
<br>
<tt>  
   setTimeout("aff_heure()",100);<br>
  }<br>
 



   

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

2003-04-01 Thread Heligon Sandra
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. 




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" %>



  

 


   
 

  



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
. 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 --


   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);
   }
  






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

2003-04-01 Thread Gareth Andrew
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 --


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);
}
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

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
> >
> >  > page="/layouts/layout1.jsp">
> >   
> >
> > 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:
> > >   
> > >   
> > >   
> > >   
> > >> > link="#023264" alink="#023264" vlink="#023264">
> > >   
> > > 
> > >> > attribute="header"/>
> > > > > attribute="menu"/>
> > > 
> > > 
> > >> > attribute='body' /> 
> > > 
> > >  
> > >   
> > >  
> > >   
> > >   
> > >   
> > >   In the header.jsp I have defined the aff_heure() script:
> > >
> > >   
> > > 
> > >   
> > > 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);
> > >   }
> > >   
> > >> > key="label.javascript.required"/>
> > > 
> > >   
> > >
> > >   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]



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
>
>  page="/layouts/layout1.jsp">
>   
>
> 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:
> > 
> > 
> > 
> > 
> >  > link="#023264" alink="#023264" vlink="#023264">
> > 
> >   
> >  > attribute="header"/>
> >   > attribute="menu"/>
> >   
> >   
> >  > attribute='body' /> 
> >   
> >
> > 
> >
> > 
> > 
> > 
> > In the header.jsp I have defined the aff_heure() script:
> >
> > 
> >   
> > 
> >   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);
> > }
> > 
> >  > key="label.javascript.required"/>
> >   
> > 
> >
> > 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

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 


  

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:
>   
>   
>   
>   
>link="#023264" alink="#023264" vlink="#023264">
>   
> 
>attribute="header"/>
> attribute="menu"/>
> 
> 
>attribute='body' /> 
> 
>  
>   
>  
>   
>   
>   
>   In the header.jsp I have defined the aff_heure() script:
>
>   
> 
>   
> 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);
>   }
>   
>key="label.javascript.required"/>
> 
>   
>
>   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]