Hi Dariusz
The thing is that the dropdowndatetimepicker is expecting the value to
be an string, which is wrong, I will submit a patch to fix it so if the
value is of type Date, it will format it using "saveFormat", and then
use it as the value. Now, I'm not sure what to do to with the submit, I
don't know how to instruct S2 to use an specific format to populate a field.
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]