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"/> <noscript><bean: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]



Reply via email to