to the main page about the tutorial  INTERACTIVE WEB SERVICES WITH JAVA back up next

Validating with Automata

A simple e-mail address can be specified by the regular expression: This can be translated into an automaton and used to generate validation in the browser:

The status icons mean:

     the text is a legal string
     the text is a proper prefix of a legal string
     every extension of the text is an illegal string


The XHTML document looks like this:
<form>
  <input type="text" name="email" size="30"/>
  <p/>
  <input type="submit" name="test" value="Submit"/>
</form>

and the validation is specified as follows:
<powerforms>
  <constraint field="email">
    <regexp pattern="[a-z0-9]+\@[a-z0-9]+(\.[a-z0-9]+)+"/>
  </constraint>
</powerforms>

back COPYRIGHT © 2002-2003 ANDERS MØLLER & MICHAEL I. SCHWARTZBACH next