Raible's Wiki

Raible Designs
Wiki Home
News
Recent Changes

AppFuse

Homepage
  - Korean
  - Chinese
  - Italian
  - Japanese

QuickStart Guide
  - Chinese
  - French
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish
  - Japanese

User Guide
  - Korean
  - Chinese

Tutorials
  - Chinese
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish

FAQ
  - Korean

Latest Downloads

Other Applications

Struts Resume
Security Example
Struts Menu

Set your name in
UserPreferences


Referenced by
AppFuseSupport




JSPWiki v2.2.33

[RSS]


Hide Menu

AppFuseStrutsDates


Difference between version 4 and version 3:

At line 2 changed 1 line.
uses a DOB where we want the user to enter a time in hours, minutes, and seconds:
uses a DOB where we want the user to enter a date in days, months and years:
At line 27 changed 1 line.
So you need three fields to capture the string input:
So you need a field to capture the string input:
At line 31 removed 2 lines.
private String hourDobString;
private String minuteDobString;
At line 35 changed 1 line.
Struts only seems to be able to set the date property as a java.lang.String...
Struts only seems to be able to set the date property as a java.lang.String... you will of course need getters and setters on these as well.
At line 45 removed 10 lines.
So we, we need to create 4 fields on our form, to capture the user inputting the dobStr, hour, minute, and second. So now our form looks like this:
{{{
public MyForm {
private String dob; - the bridge between the dob java.util.Date in your POJO and the form.
java.lang.String hour;
java.lang.String minute;
java.lang.String second;
java.lang.String dobStr;
}
At line 56 changed 2 lines.
set on your form (in your chosen dateFormat), and the hours, minutes and seconds are set
from the drop downs.
set on your form (in your chosen dateFormat).
At line 61 removed 3 lines.
public String getDob() {
if (getDateOfOffenceString()!=null && getHourOfOffenceString()!=null &&
getMinuteOfOffenceString()!=null) {
At line 65 changed 6 lines.
StringBuffer dateTime = new StringBuffer();
dateTime.append(getDateOfOffenceString());
dateTime.append(" ");
dateTime.append(getHourOfOffenceString());
dateTime.append(":");
dateTime.append(getMinuteOfOffenceString());
public Date getDob() {
if (getDobString() != null) {
this.dob = DateConverter.convertDateStringToDate(getDobString());
}
return this.datetimeOfOffence;
}
public void setDob(Date dob) {
this.dob = dob;
if (dob != null) {
setDobString(DateConverter.convertDateToDateString(
dob));
}
}
public String getDobString() {
if (getDob() != null) {
StringBuffer date = new StringBuffer();
dateTime.append(getDobString());
At line 72 changed 1 line.
}
}
At line 74 added 1 line.

Back to AppFuseStrutsDates, or to the Page History.