At line 21 changed 1 line. |
Implementing validation with Tapestry is quite simple. All you need to do is configure a "validators" property on your [TextField|http://jakarta.apache.org/tapestry/doc/ComponentReference/TextField.html] components. The validation integration for the personForm.html page is already done by AppGen in the personForm.page. If you open web/pages/personForm.page, you should see the following XML. I've highlighted the portions that are relevant to validation. |
Implementing validation with Tapestry is quite simple. All you need to do is configure a "validators" property on your [TextField|http://jakarta.apache.org/tapestry/doc/ComponentReference/TextField.html] components. The validation integration for the personForm.html page is already done by AppGen in the personForm.page. If you open web/pages/personForm.page, you should see the following XML. |
At line 23 changed 3 lines. |
<pre> |
<?xml version="1.0" encoding="UTF-8"?> |
<!DOCTYPE page-specification PUBLIC |
{{{<?xml version="1.0" encoding="UTF-8"?> |
<!DOCTYPE page-specification PUBLIC |
At line 27 changed 1 line. |
"http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd"> |
"http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd"> |
At line 29 changed 5 lines. |
<page-specification class="org.appfuse.webapp.action.PersonForm"> |
<inject property="engineService" object="engine-service:page"/> |
<inject property="request" object="service:tapestry.globals.HttpServletRequest"/> |
<inject property="response" object="service:tapestry.globals.HttpServletResponse"/> |
<inject property="personManager" type="spring" object="personManager"/> |
<page-specification class="org.appfuse.webapp.action.PersonForm"> |
<inject property="engineService" object="engine-service:page"/> |
<inject property="request" object="service:tapestry.globals.HttpServletRequest"/> |
<inject property="response" object="service:tapestry.globals.HttpServletResponse"/> |
<inject property="personManager" type="spring" object="personManager"/> |
At line 35 changed 2 lines. |
<span style="background-color: yellow"><bean name="delegate" class="org.appfuse.webapp.action.Validator"/></span> |
<property name="message" persist="flash"/> |
<bean name="delegate" class="org.appfuse.webapp.action.Validator"/> |
<property name="message" persist="flash"/> |
At line 38 changed 4 lines. |
<component id="personForm" type="Form"> |
<span style="background-color: yellow"><binding name="delegate" value="ognl:beans.delegate"/> |
<binding name="clientValidationEnabled" value="true"/></span> |
</component> |
<component id="personForm" type="Form"> |
<binding name="delegate" value="ognl:beans.delegate"/> |
<binding name="clientValidationEnabled" value="true"/> |
</component> |
At line 43 changed 10 lines. |
<component id="firstNameField" type="TextField"> |
<binding name="value" value="person.firstName"/> |
<span style="background-color: yellow"><binding name="validators" value="validators:required"/></span> |
<binding name="displayName" value="message:person.firstName"/> |
</component> |
<component id="lastNameField" type="TextField"> |
<binding name="value" value="person.lastName"/> |
<span style="background-color: yellow"><binding name="validators" value="validators:required"/></span> |
<binding name="displayName" value="message:person.lastName"/> |
</component> |
<component id="firstNameField" type="TextField"> |
<binding name="value" value="person.firstName"/> |
<binding name="validators" value="validators:required"/> |
<binding name="displayName" value="message:person.firstName"/> |
</component> |
<component id="lastNameField" type="TextField"> |
<binding name="value" value="person.lastName"/> |
<binding name="validators" value="validators:required"/> |
<binding name="displayName" value="message:person.lastName"/> |
</component> |
At line 54 changed 1 line. |
</page-specification></pre> |
</page-specification>}}} |
At line 211 changed 2 lines. |
protected void onSetUp() throws Exception { |
super.onSetUp(); |
protected void onSetUpBeforeTransaction() throws Exception { |
super.onSetUpBeforeTransaction(); |
At line 220 changed 1 line. |
super.onTearDown(); |
super.onTearDownAfterTransaction(); |
At line 378 changed 1 line. |
<Menu name="PeopleMenu" title="menu.viewPeople" forward="viewPeople"/> |
<Menu name="PeopleMenu" title="menu.viewPeople" page="/people.html"/> |