At line 50 changed 1 line. |
<img src="http://appfuse.org/appfuse/images/iconWarning.gif" class="icon" alt="Warning"> |
<img src="http://demo.appfuse.org/appfuse/images/iconWarning.gif" class="icon" alt="Warning"> |
At line 52 changed 1 line. |
<img src="http://appfuse.org/appfuse/images/iconWarning.gif" class="icon" alt="Warning"> |
<img src="http://demo.appfuse.org/appfuse/images/iconWarning.gif" class="icon" alt="Warning"> |
At line 54 changed 1 line. |
<img src="http://appfuse.org/appfuse/images/iconWarning.gif" class="icon" alt="Warning"> |
<img src="http://demo.appfuse.org/appfuse/images/iconWarning.gif" class="icon" alt="Warning"> |
At line 301 changed 1 line. |
If you try to clicking the "Save" button, you'll get a nice and descriptive <span style="background: #ffd">javax.servlet.ServletException: BeanUtils.populate</span> stack trace. This is caused by the fact that the ''struts_form.xdt'' (prior to AppFuse 1.9) did not account for plurals that ended in "ies". To fix this, replace ''metadata/web/struts_form.xdt'' with [the latest one from CVS|https://appfuse.dev.java.net/source/browse/*checkout*/appfuse/metadata/templates/struts_form.xdt] (right-click, save as). |
If you try to clicking the "Save" button, you'll get a nice and descriptive <span style="background: #ffd">javax.servlet.ServletException: BeanUtils.populate</span> stack trace. This is caused by the fact that the ''struts_form.xdt'' (prior to AppFuse 1.9) did not account for plurals that ended in "ies". To fix this, replace ''metadata/templates/struts_form.xdt'' with [the latest one from CVS|https://appfuse.dev.java.net/source/browse/*checkout*/appfuse/metadata/templates/struts_form.xdt] (right-click, save as). |
At line 303 added 33 lines. |
Run __and clean deploy__ and try clicking the ''Save'' button again. This time you might get the following lovely error: |
|
<div style="border: 2px solid red; background: #ffd; padding: 5px"> |
<img src="http://demo.appfuse.org/appfuse/images/iconWarning.gif" class="icon" alt="Warning" /> |
<strong>The process did not complete. Details should follow.</strong><br/> |
<img src="http://demo.appfuse.org/appfuse/images/iconWarning.gif" class="icon" alt="Warning" /> |
Could not convert java.lang.String to java.sql.Timestamp<br/> |
</div> |
|
I'll admit, I struggled with this issue for ''hours'' and I still don't have a good solution. From my hours of trial-and-error, the only conclusion I can come up with is that Struts (and Commons BeanUtils in particular) can't handle java.util.Date and java.sql.Timestamp together very well. If you know of a solution that'll allow displaying and saving a date and timestamp on the same form, please [comment on APF-176|http://issues.appfuse.org/browse/APF-176]. The problem is basically that I can't get the DateConverter to recognize Date as a java.util.Date - for some reason it thinks it's a Timestamp in the following logic: |
|
[{Java2HtmlPlugin |
|
if (value instanceof Date) { |
DateFormat df = new SimpleDateFormat(DateUtil.getDatePattern()); |
// this works in unit tests, but when running in Tomcat, a java.util.Date |
// comes through as a java.sql.Timestamp - wierd eh? |
if (value instanceof Timestamp) { |
df = new SimpleDateFormat(TS_FORMAT); |
} |
|
try { |
return df.format(value); |
} catch (Exception e) { |
e.printStackTrace(); |
throw new ConversionException("Error converting Date to String"); |
} |
} |
]} |
|
For the purpose of this tutorial, you'll need to replace your ''src/service/org/appfuse/util/__DateConverter.java__'' with the [latest one from CVS|https://appfuse.dev.java.net/source/browse/*checkout*/appfuse/src/service/org/appfuse/util/DateConverter.java]. |
|
|