You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Dirk Behrendt <sc...@web.de> on 2003/07/30 14:14:27 UTC

Validator Framework: Can not evaluate regular expression

Hello!

I want to check login and password fields.

If I submit with empty textfields, the errors are shown correct (....
required). But my regular expression was ignored. (see code below).

What is necessary to check regular expressions?




Dirk


Struts-config.xml
-----------------

form-bean name="loginForm"
           type="sample.LoginForm"/>

<!-- User login -->
    <action    path="/login"
               type="sample.LoginAction"
               name="loginForm"
               scope="session"
               validate="true"
               input="/loginDone.jsp">
    </action>


validation.xml
--------------

<form name="loginForm">
         <field 
           property="login"
           depends="required,mask">
           <msg name="mask" key="error.loginForm.character.maskmsg"/>
           <arg0 key="label.login"/>           
           <var>
             <var-name>mask</var-name>
             <var-value>>^[a-zA-Z0-9_.-]*$</var-value>
           </var>         	   
         </field>  
         <field 
           property="password"
           depends="required,mask">
          <msg name="mask" key="error.loginForm.character.maskmsg"/> 
          <arg0 key="label.password"/>           
           <var>
             <var-name>mask</var-name>
             <var-value>^[a-zA-Z0-9_.-]*$</var-value>
           </var>         	   
         </field>                  
      </form> 


In my JSP
-----------

<logic:messagesPresent>
   <bean:message key="errors.header"/>
   <ul>
   <html:messages id="error">
      <li><bean:write name="error"/></li>
   </html:messages>
   </ul><hr>
</logic:messagesPresent>           


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Validator Framework: Can not evaluate regular expression

Posted by Jeff Kyser <kt...@comcast.net>.
If your code is a direct cut-n-paste, you've got an extra '>' in
your first regular expression?

	<var-value>>^[a-zA-Z0-9_.-]*$</var-value>

-jeff

On Wednesday, July 30, 2003, at 07:14  AM, Dirk Behrendt wrote:

> <var-value>>^[a-zA-Z0-9_.-]*$</var-value>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org