Hello all,
I am fairly new to Struts, and have my first application working from a db
and navigation standpoint. The last piece I am trying to get working is the
validation for my forms, many of which have indexed properties based on
DTOs. I user a LazyValidationForm, though I probably didn't need to, and all
my fields will validate except the indexed ones.
Here is my struts-config, the jsp form, and the validation.xml, as well as
one of the DTOs. I am using JDK 1.5, Struts 1.2.7 and JSTL 1.1. I've looked
at every resource I can, gone from LazyValidatorForm to DynaValidatorForm
and back again, changed the validation, and nothing works. My validation
rules are simply ignored for the indexed properties. I figure at this point
I need fresh eyes to look at this and tell me what I'm doing wrong.
Here's the struts-config.xml -
<form-bean name="newInterrogation"
type="org.apache.struts.validator.LazyValidatorForm">
<form-property name="interrogationDate"
type="java.lang.String"/>
<form-property name="underlyingRhythmID"
type="java.lang.String"/>
<form-property name="batteryVoltage"
type="java.lang.String"/>
<form-property name="findings" type="java.lang.String"/>
<form-property name="deviceMsmnts"
type="ep.reporting.beans.DevicePartMeasurementTO[]"/>
<form-property name="modeSwitch" type="java.lang.String"/>
<form-property name="vTVFTherapyOption"
type="java.lang.String"/>
<form-property name="reprogramming"
type="java.lang.String"/>
<form-property name="comments" type="java.lang.String"/>
<form-property name="pmTherapyMode"
type="java.lang.String"/>
<form-property name="dfTherapies"
type="ep.reporting.beans.DefibTherapyTO[]"/>
<form-property name="implantedDevice"
type="java.lang.String"/>
<form-property name="deviceStateID"
type="java.lang.String"/>
</form-bean>
The JSP form -
<c:forEach items="${devicePartTypes}" var="deviceMsmnts" varStatus="count">
<tr>
<th>${deviceMsmnts.deviceType}</th>
<td align="center">
<html:text name="deviceMsmnts" property="prWave" size="3"
maxlength="5" value="" indexed="true" />
<html:messages id="error"
property="deviceMsmnts[${count.index}]prWave" />
</td>
<td align="center">
<html:text name="deviceMsmnts" property="impedance" size="3" maxlength="5"
value="" indexed="true" />
<html:messages id="error" property="deviceMsmnts[${count.index}]impedance"
/>
</td>
<td align="center">
<html:text name="deviceMsmnts" property="threshold" size="8" maxlength="15"
value="" indexed="true" />
<html:messages id="error" property="deviceMsmnts[${count.index}]threshold"
/>
<html:hidden name="deviceMsmnts" property="devicePartsTypeID"
value="${deviceMsmnts.deviceTypeID}" indexed="true" />
</td>
</tr>
</c:forEach>
Validation.xml -
<form-validation>
<formset>
<form name="vistaLoginForm">
<field property="accessCode" depends="required">
<arg0 key="prompt.accessCode"/>
</field>
<field property="verifyCode" depends="required">
<arg0 key="prompt.verifyCode"/>
</field>
</form>
<form name="selectPatient">
<field property="nameSSNSearch" depends="required">
<arg0 key="prompt.nameSSNSearch"/>
</field>
</form>
<form name="newInterrogation">
<field property="interrogationDate" depends="required,date">
<arg0 key="error.prompt.interrogationDate"/>
<var>
<var-name>datePattern</var-name>
<var-value>MM/dd/yyyy</var-value>
</var>
</field>
<field property="batteryVoltage" depends="required,float">
<arg0 key="error.prompt.deviceMeasurement"/>
</field>
<field property="prWave"
indexedListProperty="deviceMsmnts" depends="required,float">
<arg0 key="error.prompt.deviceMeasurement"/>
</field>
<field property="impedance"
indexedListProperty="deviceMsmnts" depends="required,float">
<arg0 key="error.prompt.deviceMeasurement"/>
</field>
<field property="dfRate" indexedListProperty="dfTherapies"
depends="required,float">
<arg0 key="error.prompt.deviceMeasurement"/>
</field>
<field property="dfTherapy"
indexedListProperty="dfTherapies" depends="required,float">
<arg0 key="error.prompt.deviceMeasurement"/>
</field>
</form>
</formset>
And the DTO -
package ep.reporting.beans;
import java.io.Serializable;
public class DevicePartMeasurementTO implements Serializable {
private int devicePartsTypeID;
private String devicePartsType;
private float prWave;
private float impedance;
private String threshold;
public DevicePartMeasurementTO()
{
}
....getters and setters
Thanks in advance for any pointers!
Jason Jones
[EMAIL PROTECTED]