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_pt
CreateActions
CreateActions_de
SpringControllers_ko
ValidationAndList_pt




JSPWiki v2.2.33

[RSS]


Hide Menu

ValidationAndList


Difference between version 8 and version 7:

At line 278 changed 1 line.
Let's create the JSP to hold our list and a Tile's definition for it. The easiest way to do this is to use the StrutsGen Tool to generate a basic list screen for us. To do this from the command-line, navigate to tools/strutsgen and run __ant -Dform.name=PersonForm__. This will generate a PersonFormList.jsp in tools/strutsgen/build. At this point, this file has a number of empty Struts tags (forwards) that we need to populate. Copy PersonFormList.jsp to web/pages/personList.jsp and open it for editing.
Let's create the JSP to hold our list and a Tile's definition for it. The easiest way to do this is to use the StrutsGen Tool to generate a basic list screen for us. To do this from the command-line, navigate to tools/strutsgen and run __ant -Dform.name=PersonForm__. This will generate a PersonFormList.jsp in tools/strutsgen/build.
At line 280 changed 1 line.
At the top of the file are a couple of <bean:struts> tags that expose forwards as page-scoped variables. Let's populate the value of the "forwards" with "editPerson" and "viewPeople", respectively.
Copy PersonFormList.jsp to web/pages/personList.jsp and open it for editing.
At line 282 added 2 lines.
At the top of the file is a <bean:struts> tags that exposes the edit screen's forward as a page-scoped variable. This should already have a value of "editPerson".
At line 286 removed 2 lines.
<%-- URL to this screen --%>
<bean:struts id="thisURL" forward="viewPeople"/>
At line 290 changed 1 line.
Now we need to add these to the metadata/web/global-forwards.xml, so they get included in our struts-config.xml file.
Now we need to add this to the metadata/web/global-forwards.xml, as well as one for viewing the list. This way, they will get included in our struts-config.xml file.
At line 294 changed 1 line.
<forward name="editPerson" path="/editPerson.do?action=Edit"/>
<forward name="editPerson" path="/editPerson.do"/>
At line 307 changed 1 line.
Now we need to notify the displaytag the name of the collection it should render. To do this, change &lt;display:table name="" ... &gt; to:
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:
At line 311 changed 1 line.
<display:table name="personList" ... >
<display:column property="id" sort="true"
headerClass="sortable"
titleKey="personForm.id"/>
At line 314 changed 1 line.
The template we used to create this JSP has the column for the id property hard-coded, so XDoclet adds it twice, and it also add columns for the "saved" and "unsaved" properties. We need to remove these from personList.jsp - so delete the following from this file:
;:''If anyone knows of a way to modify the tools/strutsgen/src/DisplayTagList_jsp.xdt to not include this column tag, please let me know.''
At line 316 changed 1 line.
[{Java2HtmlPlugin
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 318 changed 2 lines.
<display:column property="id" sort="true"
title='<%=resources.getMessage("personForm.id")%>' />
{{{<display:setProperty name="paging.banner.items_name" value="persons"/>}}}
At line 321 changed 1 line.
...
Change it to:
At line 323 changed 5 lines.
<display:column property="saved" sort="true"
title='<%=resources.getMessage("personForm.saved")%>' />
<display:column property="unsaved" sort="true"
title='<%=resources.getMessage("personForm.unsaved")%>' />
}]
{{{<display:setProperty name="paging.banner.items_name" value="people"/>}}}
At line 329 removed 2 lines.
;:''If anyone knows of a way to modify the tools/strutsgen/src/DisplayTagList_jsp.xdt to not include these values, please let me know.''
At line 364 changed 1 line.
Now that we have a List Screen, let's change the pages that are displayed after adding and deleting a new Person. In src/web/**/PersonAction.java, change the ''mapping.findForward("mainMenu")'' in the ''save'' and ''delete'' methods to be:
Now that we have a List Screen, let's change the pages that are displayed after adding and deleting a new Person. In src/web/**/PersonAction.java, change the ''mapping.findForward("mainMenu")'' in the ''save'', ''delete'' and ''cancel'' methods to be:
At line 392 removed 3 lines.
<loadfile property="web-tests.result"
srcFile="${test.dir}/data/web-tests-result.xml"/>
<echo>${web-tests.result}</echo>
At line 442 added 3 lines.
<menu:displayMenu name="FileUpload"/>
<menu:displayMenu name="FlushCache"/>
<menu:displayMenu name="Clickstream"/>

Back to ValidationAndList, or to the Page History.