First paste the exception keyword
[Com.opensymphony.xwork2.ognl.ognlvaluestack]-[warn] Error setting expression ' datetime ' with value ' [ ljava.lang.string;@74448287 ' for Object [email protected] [java.lang.NoSuchMethodException: Com.oss.Merchant.setDatetime ([Ljava.lang.String;)]
...
caused By:java.lang.NoSuchMethodException:com.oss.Merchant.setDatetime ([Ljava.lang.String;)
At OGNL. Ognlruntime.callappropriatemethod (ognlruntime.java:1246)
... 102 more
/--encapsulated exception------------\
Java.lang.NoSuchMethodException:com.oss.Merchant.setDatetime ([Ljava.lang.String;)
Describe the abnormal request again. Local, testing, formal three environments are no problem, foreign use can not be saved, view logs, found to report errors. So Baidu Google a few, there are the following explanations:
The YYYY-MM-DD format, which is not a standard time display format in foreign countries, struts interpretation is for input, which type is recently converted, such that the date of the format is mistaken for a string.
Online Professors ' solutions are:
1, build a conversion method, plus the configuration file, all the string to date are converted by this tool class.
2, the character encoding of the system from lang= "en_US". UTF-8 ", modified to: lang=" ZH_CN. UTF-8 "
3, also say with plug-in can, such as My97datepicker (my project itself is using this plugin, so I think this solution is not advisable)
4, on the JSP page with Java.util.Date first turn type (think it will not work)
Interested friends can try.
I chose the third workaround, defining a string datestr, receiving input from the form, and then
String Datestr;
New SimpleDateFormat ("Yyyy-mm-dd");D ate Date= sdf.parse (datestr); merchant.setdatetime (date);
This approach is simple, does not affect the global configuration, generally does not introduce new errors, that is, if the date input is more, it will cause a lot of duplicate code.
Struts Save Object Date quote String type mismatch