Communicate between two backing beans

Hi !
How can I communicate between backing beens ?
I would like to put data from Bean1 to Bean2.
This is my code in Bean1, I try this:
Bean2 b = new Bean2();
//... b settings...
//Map map = facesContext.getExternalContext().getRequestMap();
//map.put("Bean2", b);
HttpServletRequest request = (HttpServletRequest)facesContext.getExternalContext().getRequest();
request.setAttribute("Bean2", b);
So I put Bean2 instance in request, but JSF created new instance :(
How can I solve this problem ?

This article might give you some new insights: http://balusc.xs4all.nl/srv/dev-jep-com.html

Similar Messages

  • Communications between two Backing beans

    Hi all,
    Currently I am working in an application which contains two pages. For eg page1.jsp and and page2.jsp which contains separate backing beans and JSP pages.Here I have included page2.jsp with page1.jsp using jsp:include which will be shown in a rich:modalpanel.This rich model panel will be rendered only when a button is clicked, say choose button.
    page1.jsp
    <h:form>
    // page1 jsp codes written using JSF
    </h:form>
    <<rich:modalPanel id="lPanelId" autosized="true" top="20px" left="90px" moveable="true" styleClass="rich-modalpanel rich-mpnl_panel">
                    <jsp:include page="/page2.jsp"/> // Include page2.jsp using a modal panel
                           </rich:modalPanel> I have used two seperate forms for each page.Though I have used jsp:include the forms of two pages(page1 and page2) are submitted when clicked the link of page1. So If I change anything in page1 for example if I selected a check box and when I clicked the choose button in page 1 inorder to include page2.jsp in a modal panel. If the same check box takes place in Page2.jsp means it should also be selected but I cant able to communicate between the two backing beans.because the page1 and page2 constructors are called when the page 1 is loaded.So I cannot communicate between page1 and page2 after the choose button action.
    Please anyone out there give me some valuable inputs on this regardings.
    Thanks in Advance

    chrisjohn wrote:
    Hi everybody,
    I have used <jsp:include> tag in a jsf page to include another page(which comes in a modal panel).I would like to know how to pass values from the first backing bean to second backing bean without any button action or Html form.please give some valuable inputs on this regarding.
    Thanks in AdvanceJust access the backing bean the usual way. It is also available there in the included page.

  • Communicate between two iviews

    Hi everyone, if i create two iviews. And i want to pass a variable from one iview to the other one by triggling an event .
    What technology can help me do that?  Thx~~

    Hi Louis,
        Communication between two iviews is accomplished by EPCF concept.
      Refer to this forum thread where Prakash Singh has clearly explained about the same
    Communicate between two iviews
    Hope this helps.
    Regards,
    Joshua Kiran

  • How exchange messages between two user-bean instances?

    Hi,
    I would like to let several user to log-in my web site (I'm using tomcat) and then let them exchange some messages until they are logged-in. Is there a way using JSF?
    I was thinking about implementing a list of messages inside each user-bean. The user should know that other users are logged-in, that could be listed in a table, and click on its name. I would like that the click action create an item in the list valiable of the selected user. Is that possible using JSF? I didn't find any of such kind of communication between two user-bean instances.
    Do you have any hints? Is that the right way or is there other possibilities?
    Thanks

    You could get hold of a map of sessions in the application scope. Make use of HttpSessionListener to add/remove sessions to/from the map.
    JSF is just another component based MVC framework on top of JSP/Servlet. Everything which you can do in JSP/Servlet is just still possible. You only need to understand how JSF works under the hood.

  • How can I communicate between two simulated software

    Hallo,
    I have confusion regarding this topic "How can I communicate between two simulated software".
    1: PC with CAN simulation
    2:  PC with AFDX Simulation
    Now i have to communicated these two pc with each other.
    How can i communicated? which module from ni is best for it.
    thanks in advance
    BR

    I recommend looking at the Simple Messaging Reference Library that NI has released.  Use the TCP/IP version of it.
    FYI, TCP/IP is a communication protocol that is used to communicate between two computers.  It is what the internet uses.  So you just need a network switch or router between your computers and you can talk to each other with their IP address.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • "Sharing" a stateful session bean between two servlets, beans

    Hello!
    I just started to learn some java ee programming and was wondering how i would share one stateful session bean between two servlets.
    I created the bean with @Stateful.
    I tried to inject the stateful bean in both servlets by @EJB and i can manipulate the object, but each servlet seems to have its own object.
    The bean has a remote interface that it implements.
    What i also tried was to add the mappedName to the @Stateful expression. Something like: @Stateful(mappedName="name") and to use the bean by @EJB(mappedName="name") but it had no effect.
    Im using glassfish 2.1 with netbeans 6.7.1 as my environment (standard settings)
    dummy question, but i googled like hours and couldnt find anything : \
    hope someone can help and sorry for my bad english
    greets and thanks

    Hi there!
    I think you are searching for something like an application wide singleton. There is the possibility to define such one in the Glassfish admin console.
    Hope this helps!

  • Problem with a 1:M relationship between two entity beans

    I am having trouble trying to implement a 1:M relationship between two EJB2.0 entity beans using and EJBQL query. I have an ApplicantEJB, which contains a collection of phone numbers. The applicant table in the database has one primary key, applicant_id. The applicant_phones database table has a compound primary key--applicant_id and phone_type_id--so I have implemented a custom PK class to represent this, PhonePK. I have implemented a findByNameAndPhone method in my ejb-jar.xml file with the following syntax:
    SELECT object(a) FROM applicants a, applicant_phones p where a.applicantID = p.applicantID and a.name = ?1 and p.phoneNumber = ?2
    If I deploy this, Orion/OC4J translates the query in the orion-ejb-jar.xml with an incorrect reference to the applicant_phones.applicant_id column:
    SELECT a.applicant_id FROM applicants a , applicant_phones p WHERE ((a.applicant_id = p.applicantID ) AND (a.name = ?) AND (p.phone_number = ? ))
    I must have something wrong with the ApplicantEJB and PhoneEJB primary key mappings in my orion-ejb-jar.xml file, but I have tried many different combinations of values and keep getting them overwritten by the container with each deployment. Why is Orion/OC4J defaulting the applicant_id reference to the ob[i]Long postings are being truncated to ~1 kB at this time.

    I have posted excerpts from my orion-ejb-jar.xml file in this posting: Problem mapping a 1:M relationship between two entity EJBs w/ a compound PK
    Sorry for the duplicate postings, but I was getting errors on the submission.
    April

  • Communicate between two differente JavaFX desktop design file

    I have created two JavaFX desktop design file with netbeans 6.9.1. One is the login and the other de principal menu. In java i create a object of the principal menu an just call object.setVisible(true).
    So in javafx how to call the menu principal from the login?. what should i code in the btnLoginAction??
    this is the login javafx:
    function btnLoginAction(): Void {
    function run (): Void {
    var design = Login {};
    Stage {
    title: "Main"
    scene: design.getDesignScene ()
    }

    I'm not looking for a "tutorial created especially for me".... Just perhaps someone that can copy and paste some code from a similar project that they have done so I understand how to do it.
    You could have simply put here's a tutorial for how to use TweenLite to crossfade between four pages, and here's one that will let you pass information between two .swf files. If you recently watched the tutorials then it wouldn't take long to find them (maybe you have them bookmarked) and post a couple links.
    Anyways, I just found an excellent tutorial on how to crossfade using TweenLite (found here) and an article that explains how to pass information from one .swf to another (here). It took some searching and knowing exactly what I was looking for to find them, but that's a much better answer for someone looking to do those two things than I've found here (or elsewhere for that matter).

  • Communicate between two desktops

    Can anyone lead me to a resource, or briefly describe the process, to address the scenerio below:
    I have two Windows computers on a LAN. I need to develop an application  for each computer that (when both computers are runing the application) allows communication between the two machines. For example: pressing a button within the application on one computer would execute a function in the application of the other computer). I am comfortable building stand-alone air apps and web-based PHP/MySQL apps with Flash/Air/Dreamweaver; however, I don't know where to start when creating a connection between two computers. Any suggestions? Thanks!

    I've worked on several projects where we did this. We used a "client/server" architecture where one of the AIR apps acts as the "server" (conceptually it's the same as a web server) and the other AIR app is the "client" that connects to the server the way a web browser would talk to a web server.
    For your "client" use the Socket class.
    For your "server" use the ServerSocket class.
    Alternatively, we also used UDP sometimes, so we'd use the DatagramSocket class on both sides (both act as "sender/receiver"). However, my recollection is that we ended up moving away from UDP since it's unreliable (by design) and switched to using TCP sockets (Socket/ServerSocket).

  • To communicate between two process

    I have two processes running on two different machines. They have to communicate with each other by sharing messages in a peer to peer manner. What is the best possible way to achieve this. I have finalised upon using sockets, but reestablishing connections after other peer is brought down is a pain with sockets.
    thanks and regards.

    To exactly put it there's a GUI running on one machine and a process on other. both of these share messages. Now it must be something like bringing one down then other should not be affected it should keep buffering messages and wait for other side to come up and then start sending messages. I looked into JXTA it seemed to be a big API to work with for such a small applicaiton. It won't be a good idea to provide client with hardly some 500K of class file(or less probably) and 1.4 MB of API's. So thats why thought of writing my own communication classes which will handle this on both ends. How complicated JMS would be to work with. Does it have direct calls like register an application on some machine and then start sending and recieving messages and also take care of any of these processes being up or down.
    let me know
    thanks a ton for your support.

  • Communicate between two JInternalFrames

    Hello all.
    I have a swing application where I have a JFrame that encompasses two JInternalFrame's.
    We'll call them AppFrame, IFrame and StatusFrame
    I am attempting to create a running log of messages (Strings) that will be shown in StatusFrame.
    The IFrame will be generating these messages that need to show up on StatusFrame.
    Both are invoked by AppFrame.
    My question is: How do I pass the message from IFrame to StatusFrame? I imagine it will involve some object sharing, but my brain is fried.
    If anyone could point me in the right direction, I would appreciate it.
    Thanks!

    Thanks for bringing me up to speed!
    Just a couple of questions...please forgive me, I am very new to homegrowing listeners.
    1) When you said "which should save off the listener in some collection", how would you go about taking StatusListener listener and storing it, and, how do I access it to send a status? Do I access it by using:
    listener.statusChanged("message")?
    2) When you say "use the addStatusListener method of the iframe to add itself", just for clarification, I assume you mean something to the effect of:
    iframe.addStatusListener(statusFrame) , right?
    Again, thank you for helping me understand. I'm not quite there, but I am a lot further than I was yesterday.
    Message was edited by:
    nawlej

  • Communicate between two (same) Applications

    Hi there,
    I've written a server application in java.
    This Server is always running in the background.
    For restart/shutdown or similar purpose I want to communicate with this application.
    Is ist possible to start the same application with a args-flag that causes the running server to shutdown.
    I know it's easy possible by doing this via the socket connection.
    Because of security-reasons I want to avoid this. To limit this to the localhost is to insecure.
    Any ideas?

    Ok, I will explain it in detail.
    I don't want to open a new Port for this,
    so it is possible to use the existing open port.
    The idea to limit control sequences to localhost can made by Socket.getInetAdress() (maybe insecure (fake IP)) for the existing port or via Konstruktor of ServerSocket for a new port
    The point is:
    I dont't want to grant access to other users on this machine!
    And I don't want to limit a port for localhost from the system-enviroment via root-possibilities.
    If there is no other possibility, I think I try to use a new Port for this. I just wanted to know if this is the only possibility or are there other easier ways.
    Thanx for helping
    thosta

  • How Can i communicate between two iviews?

    Hi all,
       I am having two iviews.I want to conect those two in two pages.How can i do this?Can any one help me out from this?
    regards
    Sudeep.

    Hi ,
    Try this
    WDPortalNavigation.navigateAbsolute("ROLES:"+iview,WDPortalNavigationMode.SHOW_INPLACE,(String) null, (String) null, WDPortalNavigationHistoryMode.NO_DUPLICATIONS,(String) null,(String) null,"Param=Paramvalue");
    "ROLES:"+iview=Iview Path
    "Param=Paramvalue"=Parameter and its value
    Youcan receive the value as
    String parmvalue=WDWebContextAdapter.getWebContextAdapter().getRequestParameter("Param");
    Kind Regards
    Mukesh

  • How to communicate between two servlet applications.

    I want to write a program that the system manager can see who is connecting the server.
    the system manager login the server via the browser with applet.
    the applet communicate with servlet .and the servlet work in the server get the customer message such as username ,Ip address etc from other servlet.
    how to realize it .?
    can you give some advice .
    I appreciate you .
    thank you

    Look at, http://forum.java.sun.com/thread.jsp?forum=54&thread=262144

  • Communicate between two tabs

    Hi friends,
    I have a small issue. I am using struts pdk tags to develop portlets. My region has got 2 tabs(say tabX,tabY).And the content of each tab is a pdk portlet. When i click on a image in tabX,how can i display tabY. Pls help me out.
    Rgds,
    Dhananjay.

    We cant do that way since, a tab is not a jsp. but while fwd my response from an action class it should be a jsp. Hope u r clear. If any clarifications ask me.Hi,
    You can do the link pointing to your tab as sandeep said. Pointing means the jsp page will be added into portal page as a portlet after deployment.
    Then as sandeep suggested you can redirect to that portal page which is having the jsp and the tabs.
    Regards,
    Vijay.B

Maybe you are looking for

  • Problem with Brother DCP7040 printer

    I'm having trouble printing out a test page to a remote Brother DCP 7040 printer, whose driver isn't readily available in the repositories or AUR. Whenever I try to print the test page (from the system-config-printer tool), cups gives me the error: /

  • Ipod 2nd gen not connecting to bluetooth

    Hi I have an ipod 2nd gen that i would like to pair with my Windows 7 laptop but for some reason it wont....Is it due to wrong specifications o nthe ipod?

  • How to use sequence in MS sql server?

    In Oracle DB we use sequence like that: SequenceImpl s = new SequenceImpl("customer_seq", getDBTransaction()); Integer next = (Integer)s.getData(); setId(new Number(next.intValue())); But there is no sequence in sql server ,how can I do? Thank you~~

  • Use of q operator in oracle 11g

    Hi, I am looking for following data Rewards–ALL (UK/IE,US,Germany & China). even though i have used q operator. when report is generated using following query and UTL_FILE in excel sheet it show following data Rewardsâ€"ALL (UK/IE,US,Germany & China)

  • Web Services with complext objects as method parameters

    Can anyone point me to an example of web services that accept complex objects as parameters, using annotations? Appreciate it.