Here is my JSP:
================
<tr>
<td><bean:message key="alert.endingDate"/></td>
<td><html:text property="endingDate" size="32" maxlength="32" /></td>
</tr>My DynaForm declaration:
-=======================
<form-bean name="alertForm"
dynamic="true"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="alertId" type="java.lang.String" />
<form-property name="userId" type="java.lang.Long" /><form-property name="subject" type="java.lang.String" />
<form-property name="startingDate" type="java.util.Date" />
<form-property name="reoccurring" type="java.lang.String" />
<form-property name="gracePeriodDays" type="java.lang.String" />
<form-property name="gracePeriodHours" type="java.lang.String" />
<form-property name="endingDate" type="java.util.Date" />
<form-property name="status" type="java.lang.String" />
<form-property name="safeConfirm" type="java.lang.String" />
<form-property name="details" type="java.lang.String" />
<form-property name="noteToContactees" type="java.lang.String" />
<form-property name="alertContacts" type="java.lang.String[]" />
<form-property name="userContacts" type="com.baselogic.yoursos.contact.ContactDto[]" />
<!--<form-property name="userContacts" type="com.baselogic.yoursos.contact.ContactDto[]" />-->
<!--<form-property name="alertLocations" type="com.baselogic.yoursos.location.LocationDto[]" />-->
</form-bean>
My Action Declaration: ======================= <action path="/alert" input="/alertList.do" name="alertForm" parameter="action" scope="request" type="com.baselogic.yoursos.alert.AlertActions" validate="true" > <forward name="success" path="/alertList.do" redirect="true" /> <forward name="error" path=".error" redirect="true" /> <forward name="add" path=".alertAdd" redirect="true" /> <forward name="edit" path=".alertEdit" redirect="true" /> <forward name="view" path=".alertView" redirect="true" /> </action>
My AlertActions.java default method: ==================================== public ActionForward defaultMethod( ActionMapping mapping , ActionForm form , HttpServletRequest request , HttpServletResponse response ) throws AlertNotFoundException, Exception { log.info( "Process a AlertActions.defaultMethod()" );
//IUserServices usd = this.getUserService();
AlertDto alertDto = new AlertDto();
//form = setFormDatesToDate( form );
BeanUtils.copyProperties( alertDto, form );UserDto userDto = this.getUserService().findUser( getUserContainer( request ).getUserLightDto().getUserId() );
ContactDto[] userContacts = userDto.getUserContacts();
log.info( "userContacts[] length: " + userContacts.length );
if( alertDto.getAlertId().equals( "" ) )
{
// Must be a new alert then....
log.info( "Must be a new alert then...." );
alertDto.setUserId( userDto.getUserId() );
log.info( "alertDto: " + alertDto.toString() );( ( DynaActionForm ) form ).set( Constants.USER_CONTACTS_KEY, userContacts );
BeanUtils.copyProperties( form, alertDto );
//form = setFormDatesToString( form );
return ( mapping.findForward( Constants.ADD_FWD ) );
}log.info( "Must be an existing alert then...." );
// Get the required AlertDto...
alertDto = this.getAlertService().findAlert( alertDto.getAlertId() );
// Do we need to re-set the 2 dates from Dates, into Strings here?
BeanUtils.copyProperties( form, alertDto );// We need to add the String[] object from our ContactDto[]
return ( mapping.findForward( Constants.VIEW_FWD ) ); }
My AlertActions.java add method: ==================================== public ActionForward add( ActionMapping mapping , ActionForm form , HttpServletRequest request , HttpServletResponse response ) throws Exception { try { if( log.isInfoEnabled() ) { log.info( "Process a alert add(...)" ); log.info( "alertForm::add(): " + form.toString() ); }
IAlertServices asd = this.getAlertService();
UserLightDto userlightDto = getUserContainer( request ).getUserLightDto();
// We are forced to take a String as a Date, then reformat it to a Date when we add or modify it.
form = setFormDatesToDate( form );
AlertDto alertDto = new AlertDto();
BeanUtils.copyProperties( alertDto, form ); if( log.isInfoEnabled() )
{
log.info( "alertUpdate.dto: " + alertDto.toString() );
} if( alertDto.getAlertId().equals( "" ) )
{
// Must be a new alert then....add it
log.info( "Must be a new alert then....Add it" );// First we need to create the ContactDto objects from our String[]
String[] alertContacts = (String[])( (DynaActionForm) form ).get( Constants.ALERT_CONTACTS_KEY );
// We first have to create the alert. Then, only after creation, can we add the contacts.
alertDto = asd.alertCreate( alertDto );
log.info( "String[] alertContacts length: " + alertContacts.length );
setAlertContactsFromForm( alertDto, alertContacts );
alertDto = asd.alertUpdate( alertDto );
return ( mapping.findForward( Constants.SUCCESS_FWD ) );
}
// Forward control to the specified success URI
return ( mapping.findForward( Constants.SUCCESS_FWD ) );
}
catch( Exception e )
{
log.error( "Exception adding alert; " + e.getMessage(), e );
throw e;
}
}My XDoclet Generated ValueObject: =================================== /* * Generated file - Do not edit! */ package com.baselogic.yoursos.alert;
import java.util.*;
/**
* Value object for Alert.
*
* @xdoclet-generated at 31-05-03
* @copyright YourSOS
* @author mknutson
* @version xxx
*/
public class AlertDto
extends java.lang.Object
implements java.io.Serializable
{
private java.lang.String alertId;
private boolean alertIdHasBeenSet = false;
private java.lang.Long userId;
private boolean userIdHasBeenSet = false;
private java.lang.String subject;
private boolean subjectHasBeenSet = false;
private java.util.Date startDate;
private boolean startDateHasBeenSet = false;
private java.lang.String reoccurring;
private boolean reoccurringHasBeenSet = false;
private java.lang.String gracePeriodDays;
private boolean gracePeriodDaysHasBeenSet = false;
private java.lang.String gracePeriodHours;
private boolean gracePeriodHoursHasBeenSet = false;
private java.util.Date endingDate;
private boolean endingDateHasBeenSet = false;
private java.lang.String startingLocation;
private boolean startingLocationHasBeenSet = false;
private java.lang.String endingLocation;
private boolean endingLocationHasBeenSet = false;
private java.lang.String status;
private boolean statusHasBeenSet = false;
private java.lang.String safeConfirm;
private boolean safeConfirmHasBeenSet = false;
private java.lang.String details;
private boolean detailsHasBeenSet = false;
private java.lang.String noteToContactees;
private boolean noteToContacteesHasBeenSet = false;
private Collection Contacts = new java.util.ArrayList();
private Collection Locations = new java.util.ArrayList();private java.lang.String pk;
public AlertDto()
{
}public AlertDto( java.lang.String alertId,java.lang.Long userId,java.lang.String subject,java.util.Date startDate,java.lang.String reoccurring,java.lang.String gracePeriodDays,java.lang.String gracePeriodHours,java.util.Date endingDate,java.lang.String startingLocation,java.lang.String endingLocation,java.lang.String status,java.lang.String safeConfirm,java.lang.String details,java.lang.String noteToContactees )
{
this.alertId = alertId;
alertIdHasBeenSet = true;
this.userId = userId;
userIdHasBeenSet = true;
this.subject = subject;
subjectHasBeenSet = true;
this.startDate = startDate;
startDateHasBeenSet = true;
this.reoccurring = reoccurring;
reoccurringHasBeenSet = true;
this.gracePeriodDays = gracePeriodDays;
gracePeriodDaysHasBeenSet = true;
this.gracePeriodHours = gracePeriodHours;
gracePeriodHoursHasBeenSet = true;
this.endingDate = endingDate;
endingDateHasBeenSet = true;
this.startingLocation = startingLocation;
startingLocationHasBeenSet = true;
this.endingLocation = endingLocation;
endingLocationHasBeenSet = true;
this.status = status;
statusHasBeenSet = true;
this.safeConfirm = safeConfirm;
safeConfirmHasBeenSet = true;
this.details = details;
detailsHasBeenSet = true;
this.noteToContactees = noteToContactees;
noteToContacteesHasBeenSet = true;
pk = this.getAlertId();
}
//TODO Cloneable is better than this !
public AlertDto( AlertDto otherValue )
{
this.alertId = otherValue.alertId;
alertIdHasBeenSet = true;
this.userId = otherValue.userId;
userIdHasBeenSet = true;
this.subject = otherValue.subject;
subjectHasBeenSet = true;
this.startDate = otherValue.startDate;
startDateHasBeenSet = true;
this.reoccurring = otherValue.reoccurring;
reoccurringHasBeenSet = true;
this.gracePeriodDays = otherValue.gracePeriodDays;
gracePeriodDaysHasBeenSet = true;
this.gracePeriodHours = otherValue.gracePeriodHours;
gracePeriodHoursHasBeenSet = true;
this.endingDate = otherValue.endingDate;
endingDateHasBeenSet = true;
this.startingLocation = otherValue.startingLocation;
startingLocationHasBeenSet = true;
this.endingLocation = otherValue.endingLocation;
endingLocationHasBeenSet = true;
this.status = otherValue.status;
statusHasBeenSet = true;
this.safeConfirm = otherValue.safeConfirm;
safeConfirmHasBeenSet = true;
this.details = otherValue.details;
detailsHasBeenSet = true;
this.noteToContactees = otherValue.noteToContactees;
noteToContacteesHasBeenSet = true;
// TODO Clone is better no ?
this.Contacts = otherValue.Contacts;
// TODO Clone is better no ?
this.Locations = otherValue.Locations;pk = this.getAlertId(); }
public java.lang.String getPrimaryKey()
{
return pk;
} public void setPrimaryKey( java.lang.String pk )
{
// it's also nice to update PK object - just in case
// somebody would ask for it later...
this.pk = pk;
setAlertId( pk );
} public java.lang.String getAlertId()
{
return this.alertId;
} public void setAlertId( java.lang.String alertId )
{
this.alertId = alertId;
alertIdHasBeenSet = true;pk = alertId; }
public boolean alertIdHasBeenSet(){
return alertIdHasBeenSet;
}
public java.lang.Long getUserId()
{
return this.userId;
} public void setUserId( java.lang.Long userId )
{
this.userId = userId;
userIdHasBeenSet = true;}
public boolean userIdHasBeenSet(){
return userIdHasBeenSet;
}
public java.lang.String getSubject()
{
return this.subject;
} public void setSubject( java.lang.String subject )
{
this.subject = subject;
subjectHasBeenSet = true;}
public boolean subjectHasBeenSet(){
return subjectHasBeenSet;
}
public java.util.Date getStartDate()
{
return this.startDate;
} public void setStartDate( java.util.Date startDate )
{
this.startDate = startDate;
startDateHasBeenSet = true;}
public boolean startDateHasBeenSet(){
return startDateHasBeenSet;
}
public java.lang.String getReoccurring()
{
return this.reoccurring;
} public void setReoccurring( java.lang.String reoccurring )
{
this.reoccurring = reoccurring;
reoccurringHasBeenSet = true;}
public boolean reoccurringHasBeenSet(){
return reoccurringHasBeenSet;
}
public java.lang.String getGracePeriodDays()
{
return this.gracePeriodDays;
} public void setGracePeriodDays( java.lang.String gracePeriodDays )
{
this.gracePeriodDays = gracePeriodDays;
gracePeriodDaysHasBeenSet = true;}
public boolean gracePeriodDaysHasBeenSet(){
return gracePeriodDaysHasBeenSet;
}
public java.lang.String getGracePeriodHours()
{
return this.gracePeriodHours;
} public void setGracePeriodHours( java.lang.String gracePeriodHours )
{
this.gracePeriodHours = gracePeriodHours;
gracePeriodHoursHasBeenSet = true;}
public boolean gracePeriodHoursHasBeenSet(){
return gracePeriodHoursHasBeenSet;
}
public java.util.Date getEndingDate()
{
return this.endingDate;
} public void setEndingDate( java.util.Date endingDate )
{
this.endingDate = endingDate;
endingDateHasBeenSet = true;}
public boolean endingDateHasBeenSet(){
return endingDateHasBeenSet;
}
public java.lang.String getStartingLocation()
{
return this.startingLocation;
} public void setStartingLocation( java.lang.String startingLocation )
{
this.startingLocation = startingLocation;
startingLocationHasBeenSet = true;}
public boolean startingLocationHasBeenSet(){
return startingLocationHasBeenSet;
}
public java.lang.String getEndingLocation()
{
return this.endingLocation;
} public void setEndingLocation( java.lang.String endingLocation )
{
this.endingLocation = endingLocation;
endingLocationHasBeenSet = true;}
public boolean endingLocationHasBeenSet(){
return endingLocationHasBeenSet;
}
public java.lang.String getStatus()
{
return this.status;
} public void setStatus( java.lang.String status )
{
this.status = status;
statusHasBeenSet = true;}
public boolean statusHasBeenSet(){
return statusHasBeenSet;
}
public java.lang.String getSafeConfirm()
{
return this.safeConfirm;
} public void setSafeConfirm( java.lang.String safeConfirm )
{
this.safeConfirm = safeConfirm;
safeConfirmHasBeenSet = true;}
public boolean safeConfirmHasBeenSet(){
return safeConfirmHasBeenSet;
}
public java.lang.String getDetails()
{
return this.details;
} public void setDetails( java.lang.String details )
{
this.details = details;
detailsHasBeenSet = true;}
public boolean detailsHasBeenSet(){
return detailsHasBeenSet;
}
public java.lang.String getNoteToContactees()
{
return this.noteToContactees;
} public void setNoteToContactees( java.lang.String noteToContactees )
{
this.noteToContactees = noteToContactees;
noteToContacteesHasBeenSet = true;}
public boolean noteToContacteesHasBeenSet(){
return noteToContacteesHasBeenSet;
}protected Collection addedContacts = new java.util.ArrayList(); protected Collection removedContacts = new java.util.ArrayList(); protected Collection updatedContacts = new java.util.ArrayList();
public Collection getAddedContacts() { return addedContacts; }
public Collection getRemovedContacts() { return removedContacts; }
public Collection getUpdatedContacts() { return updatedContacts; } public void setAddedContacts(Collection addedContacts)
{
this.addedContacts.clear();
this.addedContacts.addAll(addedContacts);
} public void setRemovedContacts(Collection removedContacts)
{
this.removedContacts.clear();
this.removedContacts.addAll(removedContacts);
} public void setUpdatedContacts(Collection updatedContacts)
{
this.updatedContacts.clear();
this.updatedContacts.addAll(updatedContacts);
}public com.baselogic.yoursos.contact.ContactDto[] getContacts()
{
return (com.baselogic.yoursos.contact.ContactDto[])this.Contacts.toArray(new com.baselogic.yoursos.contact.ContactDto[Contacts.size()]);
}
public void setContacts(com.baselogic.yoursos.contact.ContactDto[] Contacts)
{
this.Contacts.clear();
for (int i=0; i < Contacts.length; i++)
this.Contacts.add(Contacts[i]);
}
public void clearContacts()
{
this.Contacts.clear();
} public void addContact(com.baselogic.yoursos.contact.ContactDto added)
{
this.Contacts.add(added);
if ( ! this.addedContacts.contains(added))
this.addedContacts.add(added);
}public void removeContact(com.baselogic.yoursos.contact.ContactDto removed)
{
this.Contacts.remove(removed);
this.removedContacts.add(removed);
if (this.addedContacts.contains(removed))
this.addedContacts.remove(removed);
if (this.updatedContacts.contains(removed))
this.updatedContacts.remove(removed);
}
public void updateContact(com.baselogic.yoursos.contact.ContactDto updated)
{
if ( !this.updatedContacts.contains(updated) && !this.addedContacts.contains(updated))
this.updatedContacts.add(updated);
}
public void cleanContact(){
this.addedContacts = new java.util.ArrayList();
this.removedContacts = new java.util.ArrayList();
this.updatedContacts = new java.util.ArrayList();
} public void copyContactsFrom(com.baselogic.yoursos.alert.AlertDto from)
{
// TODO Clone the List ????
this.Contacts = from.Contacts;
}
protected Collection addedLocations = new java.util.ArrayList();
protected Collection removedLocations = new java.util.ArrayList();
protected Collection updatedLocations = new java.util.ArrayList(); public Collection getAddedLocations() { return addedLocations; }
public Collection getRemovedLocations() { return removedLocations; }
public Collection getUpdatedLocations() { return updatedLocations; } public void setAddedLocations(Collection addedLocations)
{
this.addedLocations.clear();
this.addedLocations.addAll(addedLocations);
} public void setRemovedLocations(Collection removedLocations)
{
this.removedLocations.clear();
this.removedLocations.addAll(removedLocations);
} public void setUpdatedLocations(Collection updatedLocations)
{
this.updatedLocations.clear();
this.updatedLocations.addAll(updatedLocations);
}public com.baselogic.yoursos.location.LocationDto[] getLocations()
{
return (com.baselogic.yoursos.location.LocationDto[])this.Locations.toArray(new com.baselogic.yoursos.location.LocationDto[Locations.size()]);
}
public void setLocations(com.baselogic.yoursos.location.LocationDto[] Locations)
{
this.Locations.clear();
for (int i=0; i < Locations.length; i++)
this.Locations.add(Locations[i]);
}
public void clearLocations()
{
this.Locations.clear();
} public void addLocation(com.baselogic.yoursos.location.LocationDto added)
{
this.Locations.add(added);
if ( ! this.addedLocations.contains(added))
this.addedLocations.add(added);
}public void removeLocation(com.baselogic.yoursos.location.LocationDto removed)
{
this.Locations.remove(removed);
this.removedLocations.add(removed);
if (this.addedLocations.contains(removed))
this.addedLocations.remove(removed);
if (this.updatedLocations.contains(removed))
this.updatedLocations.remove(removed);
}
public void updateLocation(com.baselogic.yoursos.location.LocationDto updated)
{
if ( !this.updatedLocations.contains(updated) && !this.addedLocations.contains(updated))
this.updatedLocations.add(updated);
}
public void cleanLocation(){
this.addedLocations = new java.util.ArrayList();
this.removedLocations = new java.util.ArrayList();
this.updatedLocations = new java.util.ArrayList();
} public void copyLocationsFrom(com.baselogic.yoursos.alert.AlertDto from)
{
// TODO Clone the List ????
this.Locations = from.Locations;
} public String toString()
{
StringBuffer str = new StringBuffer("{");str.append("alertId=" + getAlertId() + " " + "userId=" + getUserId() + " " + "subject=" + getSubject() + " " + "startDate=" + getStartDate() + " " + "reoccurring=" + getReoccurring() + " " + "gracePeriodDays=" + getGracePeriodDays() + " " + "gracePeriodHours=" + getGracePeriodHours() + " " + "endingDate=" + getEndingDate() + " " + "startingLocation=" + getStartingLocation() + " " + "endingLocation=" + getEndingLocation() + " " + "status=" + getStatus() + " " + "safeConfirm=" + getSafeConfirm() + " " + "details=" + getDetails() + " " + "noteToContactees=" + getNoteToContactees());
str.append('}');
return(str.toString()); }
/**
* A Value object have an identity if its attributes making its Primary Key
* has all been set. One object without identity is never equal to any other
* object.
*
* @return true if this instance have an identity.
*/
protected boolean hasIdentity()
{
return alertIdHasBeenSet;
}
public boolean equals(Object other)
{
if (this == other)
return true;
if ( ! hasIdentity() ) return false;
if (other instanceof AlertDto)
{
AlertDto that = (AlertDto) other;
if ( ! that.hasIdentity() ) return false;
boolean lEquals = true;
if( this.alertId == null )
{
lEquals = lEquals && ( that.alertId == null );
}
else
{
lEquals = lEquals && this.alertId.equals( that.alertId );
}lEquals = lEquals && isIdentical(that);
return lEquals;
}
else
{
return false;
}
}public boolean isIdentical(Object other)
{
if (other instanceof AlertDto)
{
AlertDto that = (AlertDto) other;
boolean lEquals = true;
if( this.userId == null )
{
lEquals = lEquals && ( that.userId == null );
}
else
{
lEquals = lEquals && this.userId.equals( that.userId );
}
if( this.subject == null )
{
lEquals = lEquals && ( that.subject == null );
}
else
{
lEquals = lEquals && this.subject.equals( that.subject );
}
if( this.startDate == null )
{
lEquals = lEquals && ( that.startDate == null );
}
else
{
lEquals = lEquals && this.startDate.equals( that.startDate );
}
if( this.reoccurring == null )
{
lEquals = lEquals && ( that.reoccurring == null );
}
else
{
lEquals = lEquals && this.reoccurring.equals( that.reoccurring );
}
if( this.gracePeriodDays == null )
{
lEquals = lEquals && ( that.gracePeriodDays == null );
}
else
{
lEquals = lEquals && this.gracePeriodDays.equals( that.gracePeriodDays );
}
if( this.gracePeriodHours == null )
{
lEquals = lEquals && ( that.gracePeriodHours == null );
}
else
{
lEquals = lEquals && this.gracePeriodHours.equals( that.gracePeriodHours );
}
if( this.endingDate == null )
{
lEquals = lEquals && ( that.endingDate == null );
}
else
{
lEquals = lEquals && this.endingDate.equals( that.endingDate );
}
if( this.startingLocation == null )
{
lEquals = lEquals && ( that.startingLocation == null );
}
else
{
lEquals = lEquals && this.startingLocation.equals( that.startingLocation );
}
if( this.endingLocation == null )
{
lEquals = lEquals && ( that.endingLocation == null );
}
else
{
lEquals = lEquals && this.endingLocation.equals( that.endingLocation );
}
if( this.status == null )
{
lEquals = lEquals && ( that.status == null );
}
else
{
lEquals = lEquals && this.status.equals( that.status );
}
if( this.safeConfirm == null )
{
lEquals = lEquals && ( that.safeConfirm == null );
}
else
{
lEquals = lEquals && this.safeConfirm.equals( that.safeConfirm );
}
if( this.details == null )
{
lEquals = lEquals && ( that.details == null );
}
else
{
lEquals = lEquals && this.details.equals( that.details );
}
if( this.noteToContactees == null )
{
lEquals = lEquals && ( that.noteToContactees == null );
}
else
{
lEquals = lEquals && this.noteToContactees.equals( that.noteToContactees );
}
if( this.getContacts() == null )
{
lEquals = lEquals && ( that.getContacts() == null );
}
else
{
lEquals = lEquals && java.util.Arrays.equals(this.getContacts() , that.getContacts()) ;
}
if( this.getLocations() == null )
{
lEquals = lEquals && ( that.getLocations() == null );
}
else
{
lEquals = lEquals && java.util.Arrays.equals(this.getLocations() , that.getLocations()) ;
}
return lEquals;
}
else
{
return false;
}
}public int hashCode(){
int result = 17;
result = 37*result + ((this.alertId != null) ? this.alertId.hashCode() : 0);
result = 37*result + ((this.userId != null) ? this.userId.hashCode() : 0);
result = 37*result + ((this.subject != null) ? this.subject.hashCode() : 0);
result = 37*result + ((this.startDate != null) ? this.startDate.hashCode() : 0);
result = 37*result + ((this.reoccurring != null) ? this.reoccurring.hashCode() : 0);
result = 37*result + ((this.gracePeriodDays != null) ? this.gracePeriodDays.hashCode() : 0);
result = 37*result + ((this.gracePeriodHours != null) ? this.gracePeriodHours.hashCode() : 0);
result = 37*result + ((this.endingDate != null) ? this.endingDate.hashCode() : 0);
result = 37*result + ((this.startingLocation != null) ? this.startingLocation.hashCode() : 0);
result = 37*result + ((this.endingLocation != null) ? this.endingLocation.hashCode() : 0);
result = 37*result + ((this.status != null) ? this.status.hashCode() : 0);
result = 37*result + ((this.safeConfirm != null) ? this.safeConfirm.hashCode() : 0);
result = 37*result + ((this.details != null) ? this.details.hashCode() : 0);
result = 37*result + ((this.noteToContactees != null) ? this.noteToContactees.hashCode() : 0);
result = 37*result + ((this.getContacts() != null) ? this.getContacts().hashCode() : 0);
result = 37*result + ((this.getLocations() != null) ? this.getLocations().hashCode() : 0);
return result;
}
}
_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

