At line 29 changed 2 lines. |
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0//EN" |
"http://www.opensymphony.com/xwork/xwork-validator-1.0.dtd"> |
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" |
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> |
At line 56 changed 2 lines. |
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0//EN" |
"http://www.opensymphony.com/xwork/xwork-validator-1.0.dtd"> |
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" |
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> |
At line 74 changed 1 line. |
To enable validation for the "savePerson" action, you'll need to uncomment the "validator" property we commented out earlier. Make sure the "savePerson" <action> in web/WEB-INF/classes/xwork.xml has the following XML: |
WebWork's validation interceptor is enabled by default, so you don't need to configure anything for validation to work. |
At line 76 removed 7 lines. |
[{Java2HtmlPlugin |
|
<interceptor-ref name="validationStack"/> |
}] |
|
As an FYI, the validationStack used in AppFuse is a bit different from the default one that WebWork ships with. More information can be found in [WebWork's JIRA|http://jira.opensymphony.com/browse/XW-228]. |
|
At line 85 changed 1 line. |
Now that you have Validation configured for this object, whenever an action has the "validationStack" interceptor, these rules will be applied. After saving all your files and deploying, validation should kick in when you try to save this form. To test, run __ant db-load deploy__, start Tomcat and go to [http://localhost:8080/appfuse/editPerson.html?id=1]. |
After saving all your files and deploying, validation should kick in when you try to save this form. To test, run __ant db-load deploy__, start Tomcat and go to [http://localhost:8080/appfuse/editPerson.html?id=1]. |
At line 113 changed 3 lines. |
public void testGetPeople() { |
List results = mgr.getPeople(new Person()); |
assertTrue(results.size() > 0); |
public void testGetPeople() throws Exception { |
List results = new ArrayList(); |
person = new Person(); |
results.add(person); |
|
// set expected behavior on dao |
personDao.expects(once()).method("getPeople") |
.will(returnValue(results)); |
|
List people = personManager.getPeople(null); |
assertTrue(people.size() == 1); |
personDao.verify(); |
At line 219 changed 1 line. |
There should already be a personList.jsp file in ''web/pages''. If not, you can create it using viewgen. From the command-line, navigate to extras/viewgen and run __ant -Dform.name=Person__. This will generate a personList.jsp in extras/viewgen/build. |
Open the personList.jsp file in ''web/pages''. At the top of the file is a <ww:set> tags that tries to expose the "people" from PersonAction. However, by default, the generated name is just the plural of the object name. So you'll need to change the referenced value from "persons" to "people". |
At line 221 removed 4 lines. |
Once personList.jsp exists in ''web/pages'', open it for editing. |
|
At the top of the file is a <ww:set> tags that tries to expose the "people" from PersonAction. However, by default, the generated name is just the plural of the object name. So you'll need to change the referenced value from "persons" to "people". |
|
At line 230 removed 10 lines. |
The template you used to create this JSP has the column for the id property hard-coded, so XDoclet adds it twice. To remove this from personList.jsp, delete the following from this file: |
|
[{Java2HtmlPlugin |
|
<display:column property="id" sort="true" headerClass="sortable" |
titleKey="personForm.id"/> |
}] |
|
;:''If anyone knows of a way to modify the extras/viewgen/src/List_jsp.xdt to not include this column tag, please let me know.'' |
|
At line 248 changed 1 line. |
Finally, add the title and heading keys (personList.title and personList.heading) to web/WEB-INF/classes/ApplicationResources_en.properties. Open this file and add the following: |
Finally, add the title and heading keys (personList.title and personList.heading) to web/WEB-INF/classes/ApplicationResources.properties. Open this file and add the following: |
At line 336 changed 1 line. |
Where ''menu.viewPeople'' is an entry in web/WEB-INF/classes/ApplicationResources_en.properties. |
Where ''menu.viewPeople'' is an entry in web/WEB-INF/classes/ApplicationResources.properties. |
At line 345 changed 1 line. |
<Menu name="PeopleMenu" title="menu.viewPeople" forward="viewPeople"/> |
<Menu name="PeopleMenu" title="menu.viewPeople" page="/people.html"/> |
At line 380 changed 1 line. |
Total time: 2 minutes 31 seconds |
Total time: 4 minutes 15 seconds |
At line 382 removed 2 lines. |
|
If you'd like, you [can download the files created in this tutorial|https://appfuse.dev.java.net/files/documents/1397/7481/appfuse-tutorial-struts-1.6.zip]. |