I logged a ticket for this issue, with a patch:
https://issues.apache.org/struts/browse/WW-1579
The tag was not reading the value from properties. Now it will get the
value from the property specified in "name", the value needs to be of
type Date, or any object whose toString method returns an string that
can be parsed into a date, using the "displayFormat", or
SimpleDateFormat.parse(). I removed the "saveFormat" attribute because
it is confusing, the possible values for it were "rfc", "iso" or "unix".
This is Dojo stuff. Now it will always be "rfc" (RFC 3379)
regards
musachy
Dariusz Wojtas wrote:
Hi,
I ma trying to use the dropdowndatetimepicker tag but with little
success.
My Action defines field
java.util.Date registrationDate;
And here is my JSP part:
<s:dropdowndatetimepicker
name="registrationDate"
displayFormat="dd-MM-yyyy"
saveFormat="yyyy-MM-dd"
language="pl"/>
Questions that I's like to ask:
a) how do I force the tag to load initially with a value from the
property?
If I set the property to some non-null value, it is still not
displayed.
The showcase app uses an easy way, it predefines the initial value
this way:
<s:dropdowndatetimepicker
name="dddp3"
value="2006-06-26" language="en-us" />
Which means the value is already formatted for the tag by hand.
How to tell the tag to read my value from the property?
Whatever I do - it displays empty date field when loaded from action.
b) submitting the form with date
I'd like to display the date in format 'dd-MM-yyyy' (Poland)
And if I set it to the tag - it works for displaying.
But it uses the same format to send the data when the field is
submitted.
And this causes an exception because validators cannot parse it:
22:49:53,187 ERROR - Dispatcher - Could not execute
action
java.lang.NullPointerException
at
com.opensymphony.xwork2.DefaultActionInvocation.createResult(DefaultActionInvocation.java:197)
at
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:337)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:115)
at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:219)
at
com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:218)
at
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:216)
at
com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:123)
[...]
Then I thought about using the saveFormat attribute for this purpose
but it still fails.
And here is the GET url generated by the browser for two Date
properties on a form using dropdowndatetimepicker with the settings
shown above:
displayFormat="dd-MM-yyyy"
saveFormat="yyyy-MM-dd"
/myAction.action?=2006-12-22&date1=22-12-2006&=2006-12-23&date2=23-12-2006
Such request produces stacktrace.
Looks like the datepicker has empty names for the additional
properties containing values in saveFormat.
Using Struts 2.0.2
Dariusz Wojtas
---------------------------------------------------------------------
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]