Dashboard > WebWork > ... > Validation > Using Visitor Field Validator
  WebWork Log In View a printable version of the current page.  
  Using Visitor Field Validator
Added by tm_jee, last edited by Kevin Shin on Mar 04, 2007  (view change)
Labels: 
(None)

Description

The followings show a simple example using Webwork's Field Validators

Step 1

Create the jsp page

<ww:fielderror />

<ww:form method="POST" action="submitVisitorValidatorsExamples" namespace="/validation">
	<ww:textfield name="user.name" label="User Name" />
	<ww:textfield name="user.age" label="User Age" />
	<ww:textfield name="user.birthday" label="Birthday" />
	<ww:submit label="Submit" />
</ww:form>

Step 2

Create the actoin class

public class VisitorValidatorsExampleAction extends AbstractValidationActionSupport {

	private User user;
	
	public User getUser() {
		return user;
	}
	
	public void setUser(User user) {
		this.user = user;
	}
}

Step 3

Create the validator.xml.

<validators>
	<field name="user">
		<field-validator type="visitor">
			<param name="context">userContext</param>
			<param name="appendPrefix">true</param>
			<message>User:</message>
		</field-validator>
	</field>
</validators>

Site powered by a free Open Source Project / Non-profit License (more) of Confluence - the Enterprise wiki.
Learn more or evaluate Confluence for your organisation.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.2.9 Build:#527 Sep 07, 2006) - Bug/feature request - Contact Administrators