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_de
Articles_pt
Articles_zh
JSFBeans




JSPWiki v2.2.33

[RSS]


Hide Menu

ValidationAndListJSF


Difference between version 10 and version 7:

At line 11 changed 1 line.
* [1] View validation settings in personForm.jsp
* [1] View validation settings in personForm.xhtml
At line 17 changed 1 line.
* [7] Create people.jsp and Canoo test
* [7] Create people.xhtml and Canoo test
At line 23 changed 1 line.
The validation integration for the personForm.html page is already done by AppGen in the personForm.page. If you open web/personForm.jsp, you should see the following JSP Tags. I've highlighted the portions that are relevant to validation.
The validation integration for the form page is already done by AppGen in the personForm.xhtml. If you open web/personForm.xhtml, you should see the following JSP Tags. I've highlighted the portions that are relevant to validation.
At line 33 changed 1 line.
There are a [number of different validators|http://www.marinschek.com/myfaces/tiki/tiki-index.php?page=Features] you can use, this example just shows a way to validate Strings are entered. The userForm.jsp contains examples of validation e-mail and validating with regular expressions. All input fields generated by AppGen are required by default. You can change this by modifying the extras/appgen/src/**/Form_jsp.xdt file.
There are a [number of different validators|http://www.marinschek.com/myfaces/tiki/tiki-index.php?page=Features] you can use, this example just shows a way to validate Strings are entered. The userForm.xhtml contains examples of validation e-mail and validating with regular expressions. All input fields generated by AppGen are required by default. You can change this by modifying the extras/appgen/src/**/Form_xhtml.xdt file.
At line 147 changed 1 line.
In the last couple of tutorials, you've been working with the PersonForm to interact with your form JSP. Now you need to create a new Managed Bean that'll simply handle getting and displaying a list of people in the database.
In the last couple of tutorials, you've been working with the PersonForm to interact with your form view page. Now you need to create a new Managed Bean that'll simply handle getting and displaying a list of people in the database.
At line 202 changed 1 line.
Now if you run __ant test-web -Dtestcase=PersonList__, the test should pass.
Now you need to add the managed-bean definition for the PersonList class. Open web/WEB-INF/faces-config.xml and add the following managed-bean definition:
At line 204 added 15 lines.
[{Java2HtmlPlugin
<managed-bean>
<managed-bean-name>personList</managed-bean-name>
<managed-bean-class>org.appfuse.webapp.action.PersonList</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>personManager</property-name>
<value>#{personManager}</value>
</managed-property>
</managed-bean>
}]
If you run __ant test-web -Dtestcase=PersonList__, the test should pass.
At line 209 changed 1 line.
There should already be a persons.jsp file in your ''web'' directory. If not, you can create it using AppGen. From the command-line, navigate to extras/appgen and run __ant -Dobject.name=Person -Dappgen.type=pojo__. This will generate a Persons.jsp file in __extras/appgen/build/gen/web__.
There should already be a persons.xhtml file in your ''web'' directory. If not, you can create it using AppGen. From the command-line, navigate to extras/appgen and run __ant -Dobject.name=Person -Dappgen.type=pojo__. This will generate a personList.xhtml file in __extras/appgen/build/gen/web__.
At line 211 changed 1 line.
Copy Persons.jsp to ''web'' and rename it to __people.jsp__. Open it for for editing. There are two references to "personList.persons". Change those to be "personList.people".
Copy personList.xhtml to ''web'' and rename it to __people.xhtml__. Open it for for editing. There are two references to "personList.persons". Change those to be "personList.people".
At line 225 changed 1 line.
Now you need to add the managed-bean definition for the PersonList class. Open web/WEB-INF/faces-config.xml and add the following managed-bean definition:
Now you need to add the navigation-rules for this page (near the top of web/WEB-INF/faces-config.xml):
At line 229 removed 15 lines.
<managed-bean>
<managed-bean-name>personList</managed-bean-name>
<managed-bean-class>org.appfuse.webapp.action.PersonList</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>personManager</property-name>
<value>#{personManager}</value>
</managed-property>
</managed-bean>
}]
Also, add the navigation-rules for this page (near the top of faces-config.xml):
[{Java2HtmlPlugin
At line 245 changed 1 line.
<from-view-id>/people.jsp</from-view-id>
<from-view-id>/people.xhtml</from-view-id>
At line 248 changed 1 line.
<to-view-id>/personForm.jsp</to-view-id>
<to-view-id>/personForm.xhtml</to-view-id>
At line 252 changed 1 line.
<to-view-id>/personForm.jsp</to-view-id>
<to-view-id>/personForm.xhtml</to-view-id>
At line 259 changed 1 line.
Now that you have a List Screen, let's change the pages that are displayed after adding and deleting a new Person. In the faces-config.xml file, change the references for the personForm.jsp from "mainMenu" to "people".
Now that you have a List Screen, let's change the pages that are displayed after adding and deleting a new Person. In the faces-config.xml file, change the references for the personForm.xhtml from "mainMenu" to "people".
At line 264 changed 1 line.
<from-view-id>/personForm.jsp</from-view-id>
<from-view-id>/personForm.xhtml</from-view-id>
At line 267 changed 1 line.
<to-view-id>/people.jsp</to-view-id>
<to-view-id>/people.xhtml</to-view-id>
At line 272 changed 1 line.
<to-view-id>/people.jsp</to-view-id>
<to-view-id>/people.xhtml</to-view-id>
At line 350 changed 1 line.
<Menu name="PeopleMenu" title="menu.viewPeople" forward="viewPeople"/>
<Menu name="PeopleMenu" title="menu.viewPeople" page="/people.html"/>

Back to ValidationAndListJSF, or to the Page History.