At line 43 changed 1 line. |
In this step, we'll generate a ''skeleton'' or our JSP for displaying information from the PersonForm. I say ''skeleton'' because it'll just be the <form> itself. It will contain table rows and Struts' <html:text> tags for each property in PersonForm.java. The tool that we use to do this was written by [Erik Hatcher|http://www.blogscene.org/erik/]. It's basically just a single class (FormTagsHandler.java) and a couple of XDoclet templates (FormKeys.xdt and StrutsForm_jsp.xdt). All these files are located in extras/viewgen. |
In this step, you'll generate a JSP page to display information from the Person object. It will contain Struts' JSP tags that render table rows for each property in Person.java. The [AppGen] tool that's used to do this is based off a StrutsGen tool - which was originally written by [Erik Hatcher|http://www.blogscene.org/erik/]. It's basically just a couple of classes and a bunch of XDoclet templates. All these files are located in extras/appgen. |
At line 45 removed 2 lines. |
<div class="note" style="margin: 5px; background-color: #fcc">__WARNING:__ The "viewgen" tool has been deprecated in 1.6.1 and will be removed in 1.8. The <a href="http://raibledesigns.com/wiki/Wiki.jsp?page=CreateDAO#appgen">appgen</a> tool provides the same functionality.</div> |
|
At line 49 changed 8 lines. |
* Execute __ant compile__ - this generates the PersonForm.java from the Person.java POJO. |
|
* From the command-line, navigate to "extras/viewgen" |
* Execute __ant -Dform.name=PersonForm__ to generate three files in extras/viewgen/build: |
** PersonForm.properties (labels for your form elements) |
** personForm.jsp (skeleton JSP file for viewing a single Person) |
** PersonFormList.jsp (skeleton JSP file for viewing a list of People) |
* Copy the contents of PersonForm.properties into web/WEB-INF/classes/ApplicationResources_en.properties. Here is an example of what you might add to ApplicationResources_en.properties: |
* From the command-line, navigate to "extras/appgen" |
* Execute __ant -Dobject.name=Person -Dappgen.type=pojo__ to generate a bunch of files in extras/appgen/build/gen. In fact, it'll generate all the files you need to complete this tutorial. However, let's just grab the ones you need. |
** web/WEB-INF/classes/Person.properties (labels for your form elements) |
** web/personForm.jsp (JSP file for viewing a single Person) |
** web/personList.jsp (JSP file for viewing a list of People) |
* Copy the contents of Person.properties into web/WEB-INF/classes/ApplicationResources_en.properties. These are all the keys you will need for titles/headings and form properties. Here is an example of what you should add to ApplicationResources_en.properties: |
At line 60 removed 1 line. |
personForm.firstName=First Name |
At line 57 added 1 line. |
personForm.firstName=First Name |
At line 59 added 12 lines. |
|
person.added=Person has been added successfully. |
person.updated=Person has been updated successfully. |
person.deleted=Person has been deleted successfully. |
|
# -- person list page -- |
personList.title=Person List |
personList.heading=Persons |
|
# -- person detail page -- |
personDetail.title=Person Detail |
personDetail.heading=Person Information |
At line 64 changed 2 lines. |
</div> |
* Copy personForm.jsp to web/pages/personForm.jsp. Copy PersonFormList.jsp to web/pages/personList.jsp. ''Notice that each of the new filename's first character is lowercase.'' |
</div> |
* Copy personForm.jsp to web/personForm.jsp. Copy personList.jsp to web/personList.jsp. |