Here is an example of using PowerForms in a Java based webservice:
import dk.brics.powerforms.*; class Service { ... public static void main(String args) { // Create new PowerForms object PowerForms pwf = new PowerForms(); // Create Reader for PowerForms specification Reader pwf_in = ...; // Initialize PowerForms object pwf.initialize(pwf_in); // Create Reader for HTML document Reader html_in = ...; // Create PrintWriter for transformed document PrintWriter out = ...; // Transform document HtmlDocument doc = pwf.transform(html_in, out); // Send transformed document (written to `out') to the client ... // Receive values and build a Map from String to Collection Map values = ...; // Perform server-side validation doc.validate(values, new ErrorHandler() { public void error(String message) { ... } }); } }
Updated 9 May 2002 by Mikkel Ricky |