U have to specify the tipe, if your field is a timestamp have to set
the annotation in this way:
    @Temporal(TemporalType.TIMESTAMP)
    private Date datetime;

and then u can simply assign the value in this way:

setDatetime(new Date());

cheers

On Sun, Apr 12, 2009 at 15:27, lewy87 <lew...@gmail.com> wrote:
>
> For anyone looking for help related to this problem:
>
> Date must be in format "dd.mm.yyyy" and you don't even need additional field
> in action as well as converter class. Everything is mapped straight forward
> onto bean model.
>
> I don't know why, but it's compulsory in Struts2 framework.
> Quite weird, isn't it ?
>
>
>
> lewy87 wrote:
>>
>> Hello everybody,
>>
>> i'm new here and I'm looking for help concerning my Struts2 conversion
>> problem.
>>
>> Quick explanation:
>>
>> I have "LectureAction" which implements ModelDriven<Lecture> interface and
>> has method to create particular lectures. in my bean Lecture I have fields
>> such like that:
>>
>>       @Id
>>       @GeneratedValue
>>       private Integer id;
>>       private String title;
>>       private Date dateCreated; //created automatically in setter by 
>> assigning
>> new Date();
>>       private Date dateAvailable;
>>       @Lob
>>       private String content;
>>       private File file;
>>
>> The problem I have is related to field "dateAvailable". I have
>> jquery.ui.datepicker on my JSP which show calendar and inserts into
>> s:textfield date in some format.
>> Unfortunetely, Java says:
>>
>> ognl.MethodFailedException: Method "setDateAvailable" failed for object
>> edu.pjwstk.struts2.models.lect...@1f920cf
>> [java.lang.NoSuchMethodException:
>> edu.pjwstk.struts2.models.Lecture.setDateAvailable([Ljava.lang.String;)]
>>
>> So I wrote converter which converts String to Date and created properties
>> file.
>>
>> But even with that, my conversion fails.
>>
>> I tries to place field "Date dateAvailable" in my Action straight forward
>> but it also didn't help me :(
>>
>> I dunno what's wrong.
>>
>> Maybe someone had this problem?
>>
>
> --
> View this message in context: 
> http://www.nabble.com/Struts-2.1.6-conversion-problem-with-java.util.Date-tp23004386p23011063.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>



-- 
Stefano

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

Reply via email to