Hi all,
I've an action class AddEvent. In that I've a property
java.sql.Timestamp eventTime;
For this I've given getters and setters
public Timestamp getEventTime() {
return eventTime;
}
public void setEventTime(Timestamp eventTime) {
this.eventTime = eventTime;
}
But when I try to send a POST request to the action class
"http://localhost:8080/AddEvent" with parameter name="eventTime" and
value="03.09.2009 02:45:21",
I'm getting the following exception.
ognl.MethodFailedException: Method "setEventTime" failed for object
com.adsol.action.addev...@b51c29 [java.lang.NoSuchMethodException:
setEventTime([Ljava.lang.String;)]
at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:823)
at ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:964)
at
ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:75)
......
.......
at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Thread.java:619)
/-- Encapsulated exception ------------\
java.lang.NoSuchMethodException: setEventTime([Ljava.lang.String;)
at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:810)
at ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:964)
at
ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:75)
at
ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:131)
.......
.......
For that I've added the following setter function.
public void setEventTime(String eventTime) {
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy
HH:mm:ss");
Date date = null;
try{
date = sdf.parse(eventTime);
this.eventTime = new Timestamp(date.getTime());
}catch(Exception e){
this.eventTime = null;
e.printStackTrace();
}
}
But this doesn't work. I'm still getting the same
"ognl.MethodFailedException [java.lang.NoSuchMethodException:
setEventTime([Ljava.lang.String;)]".
How to solve this issue?
Thanks in advance
-Vijay
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]