This blog is helpful for those who are new in Oracle ADF 12c as well as for the professionals. This blog contains the basic and advanced concept of Oracle ADF 12c.

Sunday 12 March 2017

Different Ways to create a Managed Bean of jspx/jsf?

Create a Managed Bean for Page :-



  • Now we will create jspx page.

    Create a jsf/jspx page, for this refer to the post "How to create JSF/JSPX page by using Jdeveloper 12c?", change the page name to "TestPage2".




  • Create a managed bean for TestPage2.jspx.

Approach 1:-

  1. Open faces-config.xml file , go to the overview tab and select managed bean.

    2. Now create a managed bean by clicking on add icon.


     3.  Following popup appears and fill the following fields :-
           
          Bean Name   :-  Name of bean, Lets say "MyBean".
          Class Name   :-  MyClass
          Package         :-  Specify the package to keep this class.
          Scope             :-  Specify the memory scopes, we will select request scope.
          Registration  :- There are 2 options , One is configuration file, this will create a simple java file and other is Annotation, it will create a java class with annotation.
    
      Here we will create configuration file.

      Select the checkbox if we do not have any java class. and click ok.



      4.  You will see the entry of managed bean in faces-config.xml file.


       5.  Now this bean can be accessable on page.


            I have a button on jspx page and now we will bind button component to that bean.



Approach 2 :- 

1.  For this select the design view of TestPage2.jspx and double click on the component.
    Popup will appear.


2.  Mention the following details.

     Managed Bean :- click on new, following popup appears.
     

3.  Specify the following details:-

     Bean Name:- MyBean
     Class Name :- ShowResult
     Specify the Package.
     Scope :- Request.(you can select any scope according to the usage).

    Select the checkbox to generate a java file, and click ok.


4. Now specify the method name in ShowResult class. Let say "resultFromOtherPage", and click ok.



5. Following class is created.

0 comments:

Post a Comment

Social Profiles

Google Plus Email

Popular Posts

palash dabkara . Powered by Blogger.

Followers

Copyright © Oracle ADF 12c (Application Development Framework) Tutorial for Beginners | Powered by Blogger
Design by Palash Dabkara