commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Fleetwood, Brett \(DCS\)" <fleetwood.bre...@saugov.sa.gov.au>
Subject using struts validator for a form-property of type="org.apache.struts.upload.FormFile"
Date Wed, 24 Jan 2007 07:16:41 GMT
G'day All,
 
I'm trying to validate a form that contains a
org.apache.struts.upload.FormFile as a form property on a JSP. From the
struts HTML tag-lib I'm using <html:file> in my JSP like this;
<html:file size="80" property="fileUpload" styleClass="inputfield"
errorStyleClass="inputfielderror" />

and I've set up the form bean like this;

<form-bean name="documentUploadForm" dynamic="true"
type="au.gov.sa.dcs.dcscommon.ui.struts.form.DcsDynaValidatorForm">

    <form-property name="fileUpload"
type="org.apache.struts.upload.FormFile"/>

    <form-property name="documentIndex" type="java.lang.String" />

    <form-property name="personIndex" type="java.lang.String" />

    <form-property name="documentType" type="java.lang.String" />

    <form-property name="documentAttributeDescription"
type="java.lang.String" /> 

</form-bean>

where the DcsDynaValidatorForm extends the DynaValidatorForm.

I'm trying to validate the form by checking the text of the FormFile
object to see if its blank. This is what i've tried in validation.xml
but it doesn't get picked up;

<field property="fileUpload" depends="required" >

    <arg key="File" resource="false" position="0" />

</field>

I'm quite new to this and if i've omitted anything then please let me
know. 

Thanks in advance,

Brett.

 

 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message