How do I use a managed bean in another managed bean

I have two managed beans. One is backing bean for a form and the other is used to access a database table.
1st bean
public class TestDBAO
@PersistenceContext
private EntityManager em;
public void addEntry(PersonObj person)
em.persist(person);
public class formdata
private String id;
private String fname;
private String lname;
getter functions
setter functions
public String submit()
in here i want to call addEntry function from TestDBAO
How can I achieve this or is there another way to do this?

Do I understand correctly that you have definied TestDBAO as a session scoped managed bean? Why?
You don't need that. Just create and call TestDBAO in the backing bean. Or if you want only one instance of TestDBAO during the session, then create a singleton constructor and eventually make the methods static.

Similar Messages

  • How do you use one managed session bean from another?

    Hello -
    I am a complete newbie to JSF coming from Struts 1. My question is how do you use one managed bean from the method of another one? I think this would be a common senario. For example I put a bean in session scope when a user logs in and in a different method within a different bean I want to get some of this user's information. What is the correct way to retireve one bean from a method in another with session scope?
    Also what would the code look like to retieve another bean from the method of a managed bean where the bean you want to retrieve has application scope?
    Thank you in advance.

    Sinplicity wrote:
    Could you be a bit more specific? If a bean is configured in the faces config file then all of it's properties are managed, correct?Not necessarily.
    What would the code look like to retireve the bean?You don't retrieve it, it has been injected.
    Can I retrieve the whole bean or just a property of the bean. I would be really interested in seeing how this is done in code? And would really love a bit more information on what it means to be a managed property?Time to consult a JSF tutorial.

  • HT2492 How do I use the calculator widget in another window?

    How do I use the calculator widget in another window?  For ex: if I want to move the calculator to a window that shows prices of products on a web page.  I used to be able to click on the calculator and use it in another window, before I upgraded to OSX. What am i doing wrong?

    I think you have to bring it back up in widgets in a new window, you can set up a hot corner to make tis qciker

  • HT201209 I redeemed a gift card of $15 in mu Itunes Store.  I purchased one book in IBooks of $6.99 now the balance in my iTunes store is $ 7.10.  How Do I use this balance to buy another book or music from my Itunes Store It is not using my balance?

    I redeemed a gift card of $15 in my Itunes Store.  I purchased one book in IBooks of $6.99 now the balance in my iTunes store is $ 7.10.  How Do I use this balance to buy another book or music from my Itunes Store It is not using my balance?  Whenver I try to make a purchase it is trying to charge my Visa Credit card.  My Credit card is no more active. I want to remove my Visa credit card and use Itines gift card fro purchase in Itunes store.
    TIA
    Bikram Suri
    <Email Edited by Host>

    Sir,
    I thought So too but then I went to Itunes Library and try and buy a single song from an album for $1.29.  Now my Itunes Gift card balance is $ 7.10 as I mentioned earlier. it still did not let me buy and kept trying billing my Visa card.
    Should I restart my PC and Itunes and retry. What do you suggest?
    regards
    Bikram Suri
    [email protected]

  • I lose my iphone but i turn off icloud how i can use ( find my phone )   or another way or software

    i lose my iphone but i turn off icloud >> how i can use ( find my phone )   or another way or another sofware to find my iphone
    please help me

    You have to have iCloud enabled and Find My iPhone set to On on your iPhone in order to find it.  If you're saying you turned this off before losing it I'm afraid you're out of luck.

  • How can i use this sript and loade another movie?

    Hi there, i used the following script to load a movie from the server;
    var request:URLRequest = new URLRequest("url string");
    var loader:Loader = new Loader()
    loader.load(request);
    addChild(loader);
    How can i use this sript and loade another movie? Can someone help me please?
    [edited by moderator]

    Sir, I changed it from:
    var request:URLRequest = new URLRequest("http://agusandelsur.gov.ph/downloads/pdrrmo/agusan_del_sur/StaJosefa/Movies/Dir.swf");
    var loader:Loader = new Loader()
    loader.load(request);
    addChild(loader);
    to
    var request:URLRequest = new URLRequest("http://agusandelsur.gov.ph/downloads/pdrrmo/agusan_del_sur/StaJosefa/Movies/Warning.swf");
    var loader:Loader = new Loader()
    loader.load(request);
    addChild(loader);
    When i expord the movie i get the following error.....
    Scene 1, Layer 'Layer 3', Frame 1, Line 6    1151: A conflict exists with definition request in namespace internal.

  • How do i use my itunes account on another device?

    My phone was recently stolen so I borrowed an old 3G from a friend to use until the new iPhone launches.  How can I download apps, etc. using my iTunes account on my friend's old device? 

    If your friend's account is still logged in on it then tap on it in Settings > Store and log out of it and then log in with your account. You can then re-download your apps via the Purchased tab at the bottom of the App Store app (though you may be limited as to which apps you can re-download depending upon what iOS version the phone is on and the app's minimum requirements), and also ibooks and (depending upon which country that you are in) potentially music and tv shows/films : re-downloading.

  • How do i use a Time Machine from another computer from Time Capsule with multibackups

    Can Iuse a Time Machine from another computer from Time Capsule with multibackups

    Not sure what you are asking here. 
    Time Machine is software on a Mac that is used to backup that Mac to a Time Capsule hard drive.
    Are you asking if another  Mac can backup to the same Time Capsule that other Macs are already using?
    Or, if not....please clarify on exactly what you want to do.

  • How can I use my synced bookmarks on another computer without merge?

    I don't want end up with all the bookmarks from each PC that I use Firefox on.
    If I go to another computer that has Firefox, I don't want the bookmarks, history, etc. from this computer. In other words, absolutely no merging of my stuff with their stuff.
    I guess I want my bookmarks etc. to reside in the cloud and I want to experience Firefox on each and every device that I use as if it were my personal device, not a blend of my stuff and their stuff.

    Sync isn't meant to be used as a backup device, but merely to sync data between multiple devices.
    So it is not possible to store your bookmarks in the cloud on the sync server without syncing it to other devices.
    You would have to exclude the bookmarks and the history from syncing if you still want other personal data to get synced and backup your data locally.
    You can do that manually or via an extension like MozBackup or FEBE.
    *MozBackup: http://mozbackup.jasnapaka.com/
    *FEBE: https://addons.mozilla.org/firefox/addon/febe/
    See also:
    *https://support.mozilla.org/kb/Backing+up+your+information
    *https://support.mozilla.org/kb/Recovering+important+data+from+an+old+profile

  • How can i use an inner Jpanel in another JPanel

    Hi, i need to put an inner panel in a container panel.I have been trying for hours but I couldn't make it work. Please waiting for help...
    public class Gui extends JFrame{
         public Gui() {
              setDefaultCloseOperation(EXIT_ON_CLOSE);
              setEnabled(true);
              setSize(500, 500);
              JPanel mainPanel=new JPanel();
              int v=ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS;
              int h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS;
              JScrollPane jsp=new JScrollPane(mainPanel,v,h);
              this.add(mainPanel);
              setContentPane(jsp);
                    //this part doesn't works
              JPanel innerPanel=new JPanel();
              innerPanel.setSize(50, 50);
              innerPanel.setLocation(100, 100);
              innerPanel.setBorder(BorderFactory.createLineBorder(Color.black));
              innerPanel.setBackground(Color.red);
                   //this part doesn't works
         public static void main(String[] args) {
              Gui gui= new Gui();
              gui.setVisible(true);
    }

    I'm sorry it's my bad that i have forgotten to add the innerPanel to mainPannel (But of course i tried it in the original code :) ). Now i made the changes you suggested but there are still problems.
    I can see the innerPanel now, but the size and the position of the innerPanel doesn't works.
    public Gui() {
              setDefaultCloseOperation(EXIT_ON_CLOSE);
              setEnabled(true);
              setSize(500, 500);
              JPanel mainPanel=new JPanel();
              int v=ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS;
              int h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS;
              JScrollPane jsp=new JScrollPane(mainPanel,v,h);
              getContentPane().add(jsp);
              JPanel innerPanel=new JPanel();
              innerPanel.setSize(500, 500);
              innerPanel.setLocation(400, 400);
              innerPanel.setBorder(BorderFactory.createLineBorder(Color.black));
              innerPanel.setBackground(Color.red);
                    mainPanel.add(innerPanel);
                    //also i tried
                    //getContentPane().add(innerPanel);
                    //or
                    //jsp.add(innerPanel);        
    ...

  • How to I use Handbreak?

    I got home movies that i really like. I downloaded handbreak a month ago and watched YouTube videos of how to use it but i don't understand what they r saying.... How do i use it and is there another software i have to download???
    YES I KNOW ITS ILLEGAL TO SELL OR DISTRIBUTE....

    michael08081 wrote:
    I got home movies that i really like.
    YES I KNOW ITS ILLEGAL TO SELL OR DISTRIBUTE....
    Not if they're your personal home movies.

  • How to use remote managed bean and JPA in JSF

    Hi All,
    I am familiar with referencing backing-beans and JPA properties where Glassfish and MySQL is running locally. However, is it possible to lookup these same properties using JNDI if they reside on remote servers? If so, what change is needed?
    I would like to distribute the J2EE 5 application load including database by running Glassfish, MySQL on separate servers. This will put on the JSF (presentation-tier) components on it's own server while a secondary system will handle the middle tier processing and leaving the database activities to be carried out on another server. Not sure whether this is the right approach though. These hardware would run on both Solaris and Windows platforms.
    Unfortunately, buying faster hardware is not an option.
    Any assistance would be appreciated,
    Jack

    Hi Faissal,
    Is your suggestion below:
    //Lookup an EJB and use it
       YourRemoteBean bean = (YourRemoteBean ) ServiceLocator.findRemoteObject(jndiName); // ServiceLocator is a class that lookup
                                                                                                                                           //  the remote objectis equivalent to the following lines:
    Properties props = new Properties();
        props.setProperty("java.naming.factory.initial", "com.sun.enterprise.naming.SerialInitContextFactory");
                props.setProperty("java.naming.factory.url.pkgs", "com.sun.enterprise.naming");
                props.setProperty("java.naming.factory.state", "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
                // optional.  Defaults to localhost.  Only needed if web server is running
                // on a different host than the appserver   
                // props.setProperty("org.omg.CORBA.ORBInitialHost", "localhost");
                props.setProperty("org.omg.CORBA.ORBInitialHost", "remoteServer");
                // optional.  Defaults to 3700.  Only needed if target orb port is not 3700.
                // props.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
                InitialContext jndiContext = new InitialContext(props);     
                InitialContext jndiContext = new InitialContext();
                YourRemoteBean bean =  (YourRemoteBean) jndiContext.lookup("ejb.YourRemoteBean");Thanks,
    Jack

  • How to use application managed entity manager in EJB?

    I finish reading The EntityManager Interface in JEE tutorial.
    I know I can use container manager entity manager in EJB, but I want to explore how to use application managed entity manager in EJB.
    Can I use application managed entity manager in EJB (container management JTA transaction is used)? Where do I should close entity manager if can?
    The following is an example from JEE tutorial, but didn't find where to calose entity manager. and can I create mutiple EntityManagerFactory objects and Entity Manager objects to use them in a JTA transaction?
    @PersistenceUnit
    EntityManagerFactory emf;
    EntityManager em;
    @Resource
    UserTransaction utx;
    em = emf.createEntityManager();
    try {
      utx.begin();
      em.persist(SomeEntity);
      em.merge(AnotherEntity);
      em.remove(ThirdEntity);
      utx.commit();
    } catch (Exception e) {
      utx.rollback();

    Seems like a very poor example, the whole power of EJBs is to use Container Managed Transactions so you don't NEED to manage the transaction and the entity manager yourself. What you posted is code I would expect in a non-JEE application, or in a piece of code which requires fine-tuned transaction boundaries such as batched data importing logic.
    If I were you I'd research JPA in steps.
    a) learn about JPA as an API outside of the scope of EJBs (recommended reading: the book 'Pro JPA 2')
    b) learn about Container Managed Transactions in EJBs
    c) learn about Bean Managed Transactions in EJBs
    Right now you're rushing into c). I can understand that it raises many question marks at this point.

  • Document about how to use each BI Bean

    Anyone know whether there is any document on how to use each BI Beans besides Bean's javadoc?

    I would recommend downloading the latest BI10g samples from the BI Beans website. Click here for downloads, demos and documentation for BI Beans 10.1.2.0.0.
    For the graph there is a lot of really good information located on the Reports OTN page. This explains how to use many of the features of the BI Beans graph and contains some really good examples of how to format a graph.
    http://www.oracle.com/technology/products/reports/htdocs/faq/Graph_FAQ_with_style.html
    I would recommend reviewing the OU course on the BI Beans Query Model as this explains the basics of how to construct and manage queries:
    Oracle9i JDeveloper: Explore the BI Beans Query Model (Development Tools)
    http://education.oracle.com/pls/web_prod-plq-dad/show_desc.redirect?dc=D18655&p_org_id=1001&lang=US&source_call=
    The BI Beans query model supports powerful and flexible query techniques for analytic applications. This course explores this query model, both from an API perspective and a user interface perspective, with the goal of illustrating advanced query techniques for custom business intelligence applications.
    BI Beans 10g provides a lot of new features. We have a viewlet that explains in detail how to use one of the key new features: JSP list tags. This viewlet demonstrates a number of list tags, such as:
    * DimensionMember
    * CascadingDimensionMember
    * AWProgram
    * Navigation
    This viewlet can be viewed directly from the link on OTN:
    http://www.oracle.com/technology/products/bib/1012/viewlets/MS%20Developing%20Executive%20Insight.html
    There are OBEs posted on OTN:
    Develop Business Intelligence Objects using OracleBI Beans
    http://www.oracle.com/technology/obe/obe_bi/bibeans/bibeans_1012/developolapobjects/lessonlist.html
    Create business intelligence objects using BI Beans. These analytic objects, such as crosstabs, graphs, and calculations, can be used in either HTML-client or Java-client applications.
    Develop Business Intelligence Applications using OracleBI Beans
    http://www.oracle.com/technology/obe/obe_bi/bibeans/bibeans_1012/buildbibeansapps/lessonlist.html
    Create BI Beans HTML-client (JSP) applications and Java-client applications.
    For more information on using BI Beans graphs with non-OLAP data sources please refer to the following JDeveloper tutorial:
    Adding a BI Beans Graph in an ADF Business Components/JSP/Struts Application
    http://www.oracle.com/technology/obe/obe9051jdev/BIBeansOBE/BIBeansOBE.htm
    Hope this helps
    Oracle Business Intelligence Beans Product Management Team
    Oracle Corporation

  • How do I use copyprofile, image manager and create a wim file to Sysprep a reference Windows 8 computer.

    Im trying to deploy a reference machine (configured) to other machines (exact or close image) with different hardware.
    I have successfully used sysprep in out of the box, generalise, shutdown mode although i havent tried to deploy this to another device.  Unfortunately it doesnt copy the profile to default.
    I understand that I have to create an answer file using image manager based on that image, save it to a usb drive and attach this in the sysprep command line when sysprepping it.
    My problem is I dont know how to easily capture an image of windows 8 into a wim file so that i can add this into image manager to create a answer file.  Im also not sure what I have to do in image manager, is it a simple matter of creating and saving
    the answer file or do i have to configure it to copy the profile specifically (theres only one account anyhow).
    I also want to know if i have to attach the drivers or are all the standard drivers put into the sysprep image as standard.  I would like the machine to be an exactly replica, same as doing a clone (but with the drivers for the new machine installed
    so it will boot) same as doing a clone and then repair? If thats possible.
    Any specific instructions on this would be helpful.  I have read the microsft links but they are somewhat confusing.

    I know this is a very late response but I thought I'd post for others who search.
    The easiest way to create the .wim file is via WinPE, this guy's two YouTube videos explain the entire process in detail - 
    Windows 8 ADK Part 1: Capture an OS image - https://www.youtube.com/watch?v=XJ8zKX_8E9w
    Windows 8 ADK Part 2: Windows Image Deployment - https://www.youtube.com/watch?v=HHIvoqSw_FI
    Here's a quick rundown from my notes:
    WINPE
    Create WinPE via imaging tools command prompt
    copype amd64 c:\winpe
    makewinpemedia /iso "c:\winpe" "c:\winpe\winpe64.iso"
    UNATTEND
    Open Windows System Image Manager
    Configure unattend.xml
    Save unattend.xml to sysprep folder
    Create script and save it to sysprep folder to launch sysprep with unattend
    @echo off
    cd C:\Windows\System32\sysprep
    Sysprep /oob /generalize /unattend:C:\Windows\System32\sysprep\unattend.xml
    SYSPREP
    C:\Windows\System32\Sysprep
    Run as administrator
    OOBE/Generalize
    Shutdown
    CONFIGURATION of WINPE
    Set IP - netsh int ip set address "Local Area Connection" static 192.168.1.2 255.255.255.0 192.168.1.1
    Set DNS - netsh int ip set dns name = "Local Area Connection" source = static addr = 192.168.1.4 validate = no
    Map Network Name - net use z:
    \\WindowsADK\reflex\images password /USER:domain.local\username
    DISKPART
    diskpart
    list disk
    select disk zero
    list partition
    select partition 2 (OS partition #)
    Assign letter=S (assigns drive letter to partition)
    Exit
    DISM
    dism /capture-image /imagefile:z:\image.wim /capturedir:s:\ /name:"Windows 8.1 Custom"
    Verify image is saved in the image share (z:)
    http://www.microsoftfanboys.com

Maybe you are looking for

  • Error in DD Converter

    When i use DD Converter for migrate the weblogic 8x sp4 to weblogic 9.2 , i got the following errors: weblogic.application.ddconvert.DDConvertException: java.lang.IllegalStateException: getLocalName() may only be called on a START_ELEMENT, END_ELEMEN

  • Sorting the values in a column in a Web Template Report

    Hi All, I have a report build on WAD in which a table is displayed with certain rows and columns and have certain text values in one column and few numeral values in the other few columns. When i right click on the 1st column(having text values) and

  • PSE 7 Print Margin Problem

    Operating system is Windows 7 64bit.  I am printing to a HP 1600 series inkjet and/or a Brother 2170 wireless printer.  When I attempt to print in landscape mode, the right hand margin changes from whatever was set to 2.5" and truncates whatever is b

  • Casting of Data Types

    Hi All , I want to know if casting of data types is possible in ABAP. I mean if I have declared a datatype as data : x type char5. and Now I want to make x as char10. Is there any method to achieve this? Thanks and regards Sujeet

  • Is it mandatory to have a tap-bar in banking application?

    while making a banking application for an iPhone device, Is it mandatory to have a tap-bar in it ?