I've search the archives and can't find an answer to my question, so I'm hoping 
someone can help here.
 
I'm using the new commons-validator 1.0 recently released and Struts 1.1-b2. I cannot 
get email validation to work (i.e nothing happens when bad email addresses are 
entered). I *can* get required validation to work just fine for all fields (including 
email). I've gone through my validation configuration setup many, many times and 
simply have no idea where to go next. This is very perplexing. Any help would be 
*greatly* appreciated.
 
-ryan 
 
Here are my configurations.
 
***** struts-config.xml (appropriate entries only) *****
<form-beans>
     <form-bean name="exchange-post-form" 
type="com.thejerrysite.struts.exchange.ExchangePostActionForm">
            <form-property name="name" type="java.lang.String"/>
            <form-property name="email" type="java.lang.String"/>
            <form-property name="message" type="java.lang.String"/>
            <form-property name="formats" type="java.lang.String"/>
        </form-bean>
</form-beans>
 
<action path="/ExchangePost" 
type="com.thejerrysite.struts.exchange.ExchangePostAction"
name="exchange-post-form" 
scope="request" 
validate="true" 
input="/ExchangePost.jsp" />
 
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
        <set-property property="pathnames" value="/WEB-INF/validator-rules.xml, 
/WEB-INF/validation.xml"/>
    </plug-in>
 
***** validator-rules.xml ***** (Standard one that comes Struts 1.1-b2 - not modified)
 
***** validation.xml ***** 
<form-validation>
     <global></global>
     <formset>
        <form name="exchange-post-form">
            <field property="name" depends="required">
                <arg0 key="exchange-post-form.name.displayname"/>
            </field>

            <field property="email" depends="required,email">
                <arg0 key="exchange-post-form.email.displayname"/>
            </field>

            <field property="message" depends="required">
                <arg0 key="exchange-post-form.message.displayname"/>
            </field>

            <field property="formats" depends="required">
                <arg0 key="exchange-post-form.formats.displayname"/>
            </field>
        </form>
    </formset>
</form-validation>

***** ExchangePostAction.java (details deleted for brevity) *****
public class ExchangePostAction extends Action {

public ActionForward execute(ActionMapping mapping, .......) {
    ExchangePostActionForm form = ((ExchangePostActionForm) actionForm);
    ......
    return mapping.findForward("success-page");

}

***** ExchangePostActionForm (other fields deleted for brevity) *****
public class ExchangePostActionForm extends ValidatorForm {
    private String email;
 
    public String getEmail() {
        return email;
    }
    public void setEmail(String email) {
        this.email = email;
    }
}
 
***** ApplicationResources.properties *****
errors.required={0} is required.
errors.email={0} is an invalid e-mail address.

exchange-post-form.name.displayname=Name
exchange-post-form.email.displayname=Email
exchange-post-form.message.displayname=Message
exchange-post-form.formats.displayname=Trading Formats


Reply via email to