Home Jsf Netbeans Declaring the Bean class in the faces-config.xml file



Declaring the Bean class in the faces-config.xml file
Posted on: June 10, 2009 at 12:00 AM
This example illustrates how to define the bean in the faces-config.xml file with element.

Declaring the Bean class in the faces-config.xml file

        

This example illustrates how to define the bean in the faces-config.xml file with <managed-bean> element. Its child element <managed-bean-name> can be used to provide name for the bean. This name can be referred through out the application to access the bean. Its original class name is specified in another child element <managed-bean-class><managed-property> child element is used to specify the property value, <property-name> specifies the property name and  <value> specifies its value.

 

 

 

 



The source code of the faces-config.xml file is as follows:
 

<?xml version='1.0' encoding='UTF-8'?>

<!-- =========== FULL CONFIGURATION FILE ================================== -->

<faces-config version="1.2" 
  xmlns="http://java.sun.com/xml/ns/javaee" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
   http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
  <managed-bean>
  <managed-bean-name>SimpleLogin</managed-bean-name>
  <managed-bean-class>roseindia.SimpleLogin</managed-bean-class>
  <managed-bean-scope>request</managed-bean-scope>
  </managed-bean>
  <navigation-rule>
  <from-view-id>/login.jsp</from-view-id>
  <navigation-case>
  <from-action>#{LoginForm.CheckValidUser}</from-action>
  <from-outcome>success</from-outcome>
  <to-view-id>/success.jsp</to-view-id>
  </navigation-case>
  <navigation-case>
  <from-action>#{LoginForm.CheckValidUser}</from-action>
  <from-outcome>fail</from-outcome>
  <to-view-id>/fail.jsp</to-view-id>
  </navigation-case>
  </navigation-rule>
  
</faces-config>


Download Source Code

Related Tags for Declaring the Bean class in the faces-config.xml file:
cidesedvinamemanagedidelementforchildtoldbeaneilitcanusemanmntbeacaemagemeprosmanageeassthchipro


More Tutorials from this section

Ask Questions?    Discuss: Declaring the Bean class in the faces-config.xml file  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.