Raible's Wiki

Raible Designs
Wiki Home
News
Recent Changes

AppFuse

Homepage
  - Korean
  - Chinese
  - Italian
  - Japanese

QuickStart Guide
  - Chinese
  - French
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish
  - Japanese

User Guide
  - Korean
  - Chinese

Tutorials
  - Chinese
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish

FAQ
  - Korean

Latest Downloads

Other Applications

Struts Resume
Security Example
Struts Menu

Set your name in
UserPreferences


Referenced by
Articles
Articles_cn
Articles_pt
Articles_zh
SpringControllers
ValidationAndListSpr...




JSPWiki v2.2.33

[RSS]


Hide Menu

ValidationAndListSpring


Difference between version 32 and version 18:

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 135 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 201 changed 2 lines.
;:''You could also use a
[MultiActionController|http://www.springframework.org/docs/api/org/springframework/web/servlet/mvc/multiaction/MultiActionController.html] to handle all your List screens.''
;:''You could also use a [MultiActionController|http://www.springframework.org/docs/api/org/springframework/web/servlet/mvc/multiaction/MultiActionController.html] to handle all your List screens.''
At line 222 changed 3 lines.
ModelAndView mav =
c.handleRequest((HttpServletRequest) null,
(HttpServletResponse) null);
ModelAndView mav = c.handleRequest((HttpServletRequest) null,
(HttpServletResponse) null);
At line 267 changed 1 line.
private static Log log = LogFactory.getLog(PersonController.class);
private final Log log = LogFactory.getLog(PersonController.class);
At line 270 changed 2 lines.
public void setPersonManager(PersonManager userManager) {
this.mgr = userManager;
public void setPersonManager(PersonManager personManager) {
this.mgr = personManager;
At line 304 removed 2 lines.
Now we need to create a Tile's definition for the personList.jsp page.
At line 307 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 309 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 329 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 337 changed 1 line.
As a reminder, the {{personList.title}} is what ends up in the brower's title bar (the &lt;title&gt; tag) and
As a reminder, the {{personList.title}} is what ends up in the browser's title bar (the &lt;title&gt; tag) and
At line 411 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 450 changed 1 line.
You've completed the full lifecycle of developing a set of master-detail pages with AppFuse and Spring's MVC framework - __Congratulations__! Now the real test is if you can run all the tests in your app without failure. To test, stop tomcat and run __ant clean test-all__. This will run all the unit tests within your project. As a reminder, it should be easy to setup and test AppFuse from scratch using __ant setup-db setup-tomcat test-all__. Also, if you're looking for more robust examples - checkout [Struts Resume].
You've completed the full lifecycle of developing a set of master-detail pages with AppFuse and Spring's MVC framework - __Congratulations__! Now the real test is if you can run all the tests in your app without failure. To test, stop tomcat and run __ant clean test-all__. This will run all the unit tests within your project. As a reminder, it should be easy to setup and test AppFuse from scratch using __ant setup-db setup-tomcat test-all__. Also, if you're looking for more robust examples - checkout [Struts Resume|StrutsResume].
At line 457 removed 2 lines.
If you'd like, you [can download the files created in this tutorial|appfuse-tutorial-springmvc.zip].

Back to ValidationAndListSpring, or to the Page History.