struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eskape <eskap...@gmail.com>
Subject Re: DateTimePicker (type time) problem
Date Thu, 28 Jun 2007 13:49:07 GMT

This problem does not concern initial values. 
It is about being able to edit the time part of the given Date object into
the DateTimePicker component. 

When we want to edit the given Date ONLY, the DateTimePicker works fine.
When using the DateTimePicker as a "TimePicker (<s:datetimepicker
type="time" />)" there seems to be a problem setting the time part of the
given date, resulting the "00:00" on the page.

When we look at the rendered code we see that value of the DateTimePicker
(currentTimePart) is "2007-06-28T00:00:00+02:00"


Musachy Barroso wrote:
> 
> You need to set the initial value with the "value" attribute (or I'm
> missing
> something obvious here :) )
> 
> regards
> musachy
> 
> On 6/28/07, Kishen Simbhoedatpanday <eskapenl@gmail.com> wrote:
>>
>> Hello,
>>
>> We have a problem using the <s:datepicker> tag when it comes to modifying
>> a
>> date and time.
>> It seems there is no solution in struts2 to edit a date + time with the
>> datepicker tag, so we use them separately.
>>
>> In our Action class we have a attribute called "currentTimePart":
>>
>> private Date currentDatePart;
>> private Date currentTimePart;
>> (getter and setter are available).
>>
>> In our Action method we use the following code :
>>
>> public String modify() throws Exception {
>>         log.debug("view method called");
>>
>>         Date now = new Date();
>>         this.setCurrentDatePart(now);
>>         Calendar cal = Calendar.getInstance();
>>         cal.setTime(now);
>>         cal.set(Calendar.HOUR, 10);
>>         cal.set(Calendar.MINUTE, 15);
>>         this.setCurrentTimePart(cal.getTime());
>>
>>         return SUCCESS;
>>     }
>>
>> As you can see, the current date is set in a Calendar instance.
>> The HOUR and MINUTE are overriden and the currentTimePart is set.
>>
>> We use the following tag in the JSP page:
>> <s:datetimepicker name="currentDatePart" displayFormat="dd-MM-yyyy"
>> theme="simple" />
>> <br />
>> <s:datetimepicker name="currentTimePart" displayFormat="HH:mm"
>> theme="simple" type="time"/>
>> (Notice the type="time" attribute.)
>>
>> The page successfully shows a datePicker with the correct value, but the
>> timePicker shows the value "00:00".
>>
>> It seems that the DateTimePicker component, in struts2 or dojo framework,
>> does not handle the time part of the given Date object correctly.
>>
>> Can anyone help us out?
>>
>> Thank you!
>>
>> Greetz
>> Kishen (and co-workers)
>>
> 
> 
> 
> -- 
> "Hey you! Would you help me to carry the stone?" Pink Floyd
> 
> 

-- 
View this message in context: http://www.nabble.com/DateTimePicker-%28type-time%29-problem-tf3994225.html#a11343305
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message