Erik Weber wrote:

Not positive on this, but I think the place to set this default date string would be in your form bean's reset method. Then your JSP wouldn't need any code, the html:text field would pull the just-initialized value from the form bean, as reset would be invoked by Struts just before the JSP renders.

I think that will not be that simple, since my form is a DynavalidatorForm and all its properties are Strings. An initial value
for the questionable property can be given in struts.config.xml, which is not what i wanted


regards
Wolfgang



As far as I know, you should steer clear of using the "value" attribute to any HTML input tags. You won't get proper "memory" of what the user had entered when the page is redisplayed after a form validation error.

Someone correct me if that is not the right approach. It's what I do when I want checkboxes to be checked by default though, for example, so this seems analogous.

Erik


Wolfgang Woger wrote:



Erik Weber wrote:

Not sure about the fmt:format tag, but I use the Struts bean:write tag to format my dates:

<bean:write name="event" property="startDate" format="MM/dd/yyyy"/>

Erik



Thank you Erik,

I will try bean:write.
But by now I have an other problem. I want a new Date() as a default
value for a html-el:text element. I did:
<%
Date curDate = new Date();
String dateString = curDate.toString();
%>
<c:set var="nowDate" value="${dateString}"/>
<tr>
<td><bean:message key="someDate.displayname"/>:</td> <td><html:text property="someDate" value="${nowDate}"/></td>


But nothing can be seen in that field.

regards
Wolfgang




Wolfgang Woger wrote:

Hi,
I have a form with a Date:

<html-el:text property="someDate"  disabled="true">
     <fmt:formatDate value="${theBean.someDate}" type="date"/>
</html-el:text>

The problem: the formated date is not shown at all, it should have
functioned as the value of that input.

what can I do ?


Wolfgang


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



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