Frameworks| Hibernate| Struts| JSF| JavaFX| Ajax| Spring| DOJO| JDO| iBatis| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
Registering managed bean and defining navigation rules 
 

Managed Beans created for the application are required to be registered in the faces-config.xml file of the application.

 

Registering Managed Bean and Defining Navigation Rules

                          

Managed Beans created for the application are required to be registered in the faces-config.xml file of the application. Managed bean name and its actual class name is defined within the "managed-bean" element and navigation rules are defined within the "navigation-rule" element of the xml file.

 

 

Full view of the faces-config.xml file

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces
Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>

<application>
<locale-config>
<default-locale>en</default-locale>
</locale-config>
</application>

<managed-bean>
<managed-bean-name>LoginForm</managed-bean-name>
<managed-bean-class>LoginForm</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>

<managed-bean>
<managed-bean-name>RetrievePassword</managed-bean-name>
<managed-bean-class>RetrievePassword</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope> 
</managed-bean>

<managed-bean>
<managed-bean-name>userForm</managed-bean-name>
<managed-bean-class>UserForm</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>

<navigation-rule>
<from-view-id>/user/login.jsp</from-view-id>
<navigation-case>
<from-action>#{LoginForm.validUser}</from-action>
<from-outcome>success</from-outcome>
<to-view-id>/user/success.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-action>#{LoginPage.validUser}</from-action>
<from-outcome>failure</from-outcome>
<to-view-id>/user/login.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>forgotpassword</from-outcome>
<to-view-id>/user/forgotpassword.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>useraccount</from-outcome>
<to-view-id>/user/useraccount.jsp</to-view-id>
</navigation-case>
</navigation-rule>

<navigation-rule>
<from-view-id>/user/forgotpassword.jsp</from-view-id>
<navigation-case>
<from-action>#{RetrievePassword.check}</from-action>
<from-outcome>passwordsendingsuccess</from-outcome>
<to-view-id>/user/successpwdsend.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-action>#{RetrievePassword.check}</from-action>
<from-outcome>passwordsendingfail</from-outcome>
<to-view-id>/user/forgotpassword.jsp</to-view-id>
</navigation-case>
</navigation-rule>

<navigation-rule>
<from-view-id>/user/success.jsp</from-view-id>

<navigation-case>
<from-action>#{LoginForm.logout}</from-action>
<from-outcome>logoutsuccess</from-outcome>
<to-view-id>/user/logout.jsp</to-view-id>
</navigation-case> 
<navigation-case>
<from-action>#{userForm.editProfile}</from-action>
<from-outcome>editSuccess</from-outcome>
<to-view-id>/user/useraccount.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>changePassword</from-outcome>
<to-view-id>/user/changepassword.jsp</to-view-id>
</navigation-case>
</navigation-rule>

<navigation-rule>
<from-view-id>/user/changepassword.jsp</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/user/changepasswordsuccess.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>failure</from-outcome>
<to-view-id>/user/changepassword.jsp</to-view-id>
</navigation-case>
</navigation-rule>

<navigation-rule>
<from-view-id>*</from-view-id>
<navigation-case>
<from-outcome>gotomain</from-outcome>
<to-view-id>/user/success.jsp</to-view-id>
</navigation-case>
</navigation-rule>


<navigation-rule>
<from-view-id>/user/useraccount.jsp</from-view-id>
<navigation-case>
<from-action>#{userForm.saveUser}</from-action>
<from-outcome>successUserRegistration</from-outcome>
<to-view-id>/user/newaccountsuccess.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-action>#{userForm.saveUser}</from-action>
<from-outcome>successUserUpdate</from-outcome>
<to-view-id>/user/userUpdateSuccess.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-action>#{userForm.saveUser}</from-action>
<from-outcome>error</from-outcome>
<to-view-id>/user/useraccount.jsp</to-view-id>
</navigation-case>
</navigation-rule>

</faces-config>

                          

» View all related tutorials
Related Tags: c ajax library com ide jsf select application io components implementation vi tutorial component number name ria this richfaces id

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.