commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ryan Shriver" <>
Subject Problem with email validation
Date Mon, 02 Dec 2002 23:47:33 GMT
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.
Here are my configurations.
***** struts-config.xml (appropriate entries only) *****
     <form-bean name="exchange-post-form" type="">
            <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"/>
<action path="/ExchangePost" 
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"/>
***** validator-rules.xml ***** (Standard one that comes Struts 1.1-b2 - not modified)
***** validation.xml ***** 
        <form name="exchange-post-form">
            <field property="name" depends="required">
                <arg0 key=""/>

            <field property="email" depends="required,email">
                <arg0 key=""/>

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

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

***** (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) { = email;
***** *****
errors.required={0} is required.{0} is an invalid e-mail address.
exchange-post-form.formats.displayname=Trading Formats
View raw message