Reputation: 31
I'm working on a project using spring hibernate struts2 framework and MySQL database, I have a problem when I wanted to add a field of type Date
does not work, it means when I try to insert a Date
field, it sends me this error:
WARNING: Error setting value
ognl.MethodFailedException: Method "setDATE_PANNE" failed for object model.Panne @ 1d055e2 [java.lang.NoSuchMethodException: setDATE_PANNE ([Ljava.lang.String;)]
/ - Encapsulated exception ------------ \
java.lang.NoSuchMethodException: setDATE_PANNE ([Ljava.lang.String;)
NB: (DATE_PANNE -> this is the date fields) and setDATE_PANNE is the setter for this attribute. DATE_PANNE is of type date
apparently the problem is that struts2 has taken my Date
as a String
thing that he should not do.
I do not know how to convert and where?
Upvotes: 2
Views: 984
Reputation: 21
I have recently been working with struts 2 and have run into this ognl Exception a few times. It seems to happen when you have a control on a JSP, such as an input checkbox named "checkBox", and a method from your controller (java class, not JSP) similarly named "setCheckBox()". Somehow, behind the scenes, struts 2 or Ognl is generating a naming conflict and is unable to execute the correct method. Simply renaming either the control on the JSP (from my example from "checkBox" to "checkBox1") or renaming the method from the controller should solve your issue. Let me know if I did not elaborate enough. Hope this helps.
Regards,
Nick
Upvotes: 2