At line 1 changed 1 line. |
__Part V:__ [Adding Validation and List Screen|ValidationAndListSpring] - Adding validation logic to the Person object so that firstName and lastName are required fields and adding a list screen to display all person records in the database. |
__Part IV:__ [Adding Validation and List Screen|ValidationAndListSpring] - Adding validation logic to the Person object so that firstName and lastName are required fields and adding a list screen to display all person records in the database. |
At line 6 changed 1 line. |
This tutorial will show you how to add Validation logic (client and server-side) to the Person object using Struts' Validator. We'll also create a list screen using the [Display Tag Library|http://displaytag.sf.net] to display all the people in the database. |
This tutorial will show you how to add Validation logic (client and server-side) to the Person object using Commons Validator. We'll also create a list screen using the [Display Tag Library|http://displaytag.sf.net] to display all the people in the database. |
At line 69 changed 1 line. |
{{{<html:javascript formName="person" cdata="false" |
{{{<v:javascript formName="person" cdata="false" |
At line 109 changed 1 line. |
<html:javascript formName="personForm" cdata="false" |
<v:javascript formName="personForm" cdata="false" |
At line 139 added 1 line. |
|
At line 143 changed 2 lines. |
List persons = personManager.getPeople(null); |
assertTrue(persons.size() == 1); |
List people = personManager.getPeople(null); |
assertTrue(people.size() == 1); |
At line 310 removed 2 lines. |
Now we need to create a Tile's definition for the personList.jsp page. |
|
At line 313 changed 1 line. |
There should already be a personList.jsp in the ''web/pages'' folder of your project. If it's not there, you can use the ViewGen Tool to create it. To do this 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 the ''web/pages'' folder of your project. One thing you'll probably want to change is the plural form of the items you're listing. The generated name in this example is "persons" and it should probably be people. At or near line 31, you should have the following line: |
At line 315 removed 14 lines. |
Once personList.jsp exists in ''web/pages'', open it for editing. |
|
The template we used to create this JSP has the column for the id property hard-coded, so XDoclet adds it twice. We need to remove this from personList.jsp - so delete the following from this file: |
|
[{Java2HtmlPlugin |
|
<display:column property="id" sort="true" headerClass="sortable" |
titleKey="person.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.'' |
|
Another thing you'll probably want to change is the plural form of the items you're listing. The generated name in this example is "persons" and it should probably be people. At or near line 31, you should have the following line: |
|
At line 335 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 343 changed 1 line. |
As a reminder, the {{personList.title}} is what ends up in the brower's title bar (the <title> tag) and |
As a reminder, the {{personList.title}} is what ends up in the browser's title bar (the <title> tag) and |
At line 417 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 463 removed 2 lines. |
|
If you'd like, you [can download the files created in this tutorial|https://appfuse.dev.java.net/files/documents/1397/7487/appfuse-tutorial-spring-1.6.zip]. |