Calling the method to a different bean

Inside a workflow, I am running the code inside a managed bean, and I want to call a different managed bean method. How can I do this?

Hello

You can do this in two ways:

Using Dependency Injection:

In the configuration file of your project faces that defines the management of bean, a bean managed
property may be declared as initialized with a reference to an another managed bean:


neededBean
fqn.to.NeededBean
session


usingBean
fqn.to.UsingBean
request

neededBean
#{neededBean}

2. with the help of research

FacesContext facesContext = FacesContext.getCurrentInstance ();
NeededBean neededBean
= (NeededBean) facesContext.getApplication)
.createValueBinding("#{neededBean}").getValue (facesContext);

Tags: Java

Similar Questions

  • With the help of several classes and create an object of a class and calling its method in a different class.

    Creating a new class, I need to move my main method class SaveDate DynamicTest class. Below I've listed the code of both classes. The goal is to be able to run my class DynamicTest program. I need help to understand the process of moving my main method of a different class and creating an object of a class and calling its method.

    public class {SaveData

    private public static final map < String, Object > myCachedTreeMap = new TreeMap < String, Object > ();

    public static final List < String > getLines (final String resourceParam, final Charset charset) throws IOException {}

    System.out.println ("please:" + resourceParam);

    If {(myCachedTreeMap.containsKey (resourceParam))

    Use the file cached, to avoid a further reading.

    System.out.println ("found in memory:" + resourceParam);

    }

    else {}

    Load the file from the disk

    System.out.println ("found in memory:" + resourceParam);

    }

    Returns a null value.

    }

    Public Shared Sub main (String [] args) throws IOException {}

    String target_dir = "C:\\myfiles\\config\\en";

    Line = "C:\\myfiles\\config\\en\\output.txt";

    File dir = new File (target_dir);

    File files [] = dir.listFiles ();

    If (file == null: files.length < 1) {}

    System.out.println ("file list is empty...");

    return;

    }

    Open the Printwriter

    PrintWriter OutputStream = new PrintWriter (output);

    try {}

    for (textFile file: files) {}

    If (textFile.isFile () & & textFile.getName () .endsWith (".txt")) {}

    readFromDisk (textFile);

    }

    }

    }

    {Finally

    outputStream.close ();

    }

    String fileNameFromCache = "en_synonyms.txt";

    Sheet1 = myCachedTreeMap.get (fileNameFromCache) object;

    System.out.println (fileNameFromCache + ": \n" + "Sheet1");

    }

    @SuppressWarnings ("resource")

    private static Sub readFromDisk(File textFile) throws FileNotFoundException, IOException {}

    BufferedReader InputStream;

    inputStream = null;

    String content = "";

    try {}

    inputStream = new BufferedReader (new FileReader (textFile));

    content = readFile (textFile);

    System.out.println ("bytes read =" + content.length ());

    Save the content

    FileContentsObject Sheet1 = new FileContentsObject (System.currentTimeMillis (),

    textFile.lastModified (), content,

    textFile.getName (),

    getLines (null, null));

    Add to the map

    myCachedTreeMap.put (textFile.getName (), Sheet1);

    }

    {Finally

    If (inputStream! = null) {}

    inputStream.close ();

    }

    }

    }

    private static String readFile(File f) throws FileNotFoundException, IOException, UnsupportedEncodingException {}

    Text of StringBuilder = new StringBuilder (1024);

    read int, N = 1024 * 1024;

    char [] buffer = new char [N];

    BufferedReader br = null;

    try {}

    BR = new BufferedReader)

    (new) InputStreamReader

    (new FileInputStream (f), 'UTF8'));

    While (true) {}

    read = br.read (buffer, 0, N);

    If (read > 0)

    Text.Append (new String (buffer, 0, read));

    if(Read < N) {}

    break;

    }

    }

    }

    {Finally

    If (br! = null)

    Br. Close();

    }

    Return text.toString ();

    }

    private static final class FileContentsObject {}

    private long cachedTime; currentTime

    private long lastModifiedTimestamp;

    private string content

    List < String > lines;

    private String fileName;

    public FileContentsObject (long cachedTime, long lastModifiedTimestamp,

    Content string, String fileName, List < String > lines) {}

    this.cachedTime = cachedTime;

    this.lastModifiedTimestamp = lastModifiedTimestamp;

    This.contents = content;

    this.fileName = filename;

    This.Lines = lines;

    SimpleDateFormat sdf = new SimpleDateFormat ("MM/dd/yy hh: mm :"); ")

    System.out.println ("time & Date:" + sdf.format (cachedTime));

    System.out.println ("' last modification timestamp:" ")

    + sdf.format (lastModifiedTimestamp));

    }

    /**

    *

    * @return the lines of the file

    */

    List < String > getLines() {}

    Return this.lines;

    }

    public String toString() {}

    "return"Sheet1 {}"+" fileName =' ' + filename + '------"+", content = "" "

    + content + "\"+ ", lastModifiedTimestamp ="

    + lastModifiedTimestamp + ', CurrentTime & Date ='

    {+ cachedTime + '}';

    }

    }

    }

    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    public class DynamicTest {}

    Public Shared Sub main (String [] args) {}

    Game characters charset = Charset.forName("UTF-8");

    try {}

    List < String > = CacheData.getLines lines ("en_synonyms", character set);

    If (rows! = null) {}

    System.out.println ("number of rows:" + lines.size ());

    for {(String ligne: lines)}

    System.out.println ("DynamicTest:" + line);

    }

    }

    } catch (IOException e) {}

    e.printStackTrace ();

    }

    try {}

    List < String > = CacheData.getLines lines ("en_stopwords", character set);

    If (rows! = null) {}

    System.out.println ("number of rows:" + lines.size ());

    for {(String ligne: lines)}

    System.out.println ("DynamicTest:" + line);

    }

    }

    } catch (IOException e) {}

    e.printStackTrace ();

    }

    }

    }

    I have read and watched videos about the creation of an object of a class and calling its method in a different class. I'm still confused on how to do it properly. By using the code below if someone can explain how to properly call the method of objects from my hand.

    Huh? You have NOT posted any 'hand' or any 'method of objects '.

    If you need help with the code, you need to view the code.

    The Java tutorials has dozens of trails "Classes and objects": what they are, how to create and how to use them.

    https://docs.Oracle.com/javase/tutorial/Java/javaOO/classes.html

    1. create an instance of a class

    2. call to one or more of the public methods of this class

    If the class has public static methods, you don't need to create an instance first.

    I suggest that you work your way through these tutorials. They include the WORKING example code.

  • Call the method call activities before you navigate to the target jsf page

    Dear all,

    I use JDeveloper Studio Edition Version 12.1.3.0.0.

    Requirement:

    I have a stubborn taskflow. The stubborn workflow is without using page fragments.

    I have three pages: login.jsf, admin.jsf, user.jsf. I have a method call activity in the taskflow. The login.jsf is the default page. The page of login.jsf have an af:selectOneRadio with two af:selectItem: Admin and user. It also has an af:button. When the user select the af: af selectItem: selectOneRadio and click on the af: button, it should call the method call activity (doLogin) and based on logic it will redirect to the page admin.jsf or user.jsf page.

    Please find the taskflow below:

    How to achieve the solution to the prescription above.

    Thank you and best regards,

    Susanto Paul

    Hi all

    I'm able to resolve the obligation.

    The post below was really helpful.

    http://andrejusb.blogspot.in/2011/09/programmatic-ADF-task-flow-router.html

    Thank you best regards &,.

    Susanto Paul

  • Call the method of the object, the view object entity

    Hi all
    I use jdeveloper 11.2.1.0, and I need to call the method in the object class to view object entity class.
    Someone knows how to do?

    Thank you.

    http://andrejusb.blogspot.in/2009/11/calling-custom-entity-method-from-view.html

  • Call the method in the root Movie Clip

    Hi all

    In AS 2, I was able to call a method declared in the chronology of the root of a moviclip by placing code similar to "_root.callMethod ()". I'm doing the same AS 3, but I get an error "1119: access of the meshes of property may be undefined in a reference with static type flash.display:DisplayObject.".

    On the first frame of my main script, I have:
    var st:String = "HELLO";

    I also have a movieclip in the main scenario that has the following on its 1 setting:
    trace ("ST ROOT OF CLIP -" + root.st);

    When launched, I get the above error.

    How can I access variables declared in other clips and the main timeline and calling the methods declared in other MC and the main timeline?

    Thanks for your help in advance.
    V

    You must convert this object to display as a dynamic class - for example, a movieclip:

  • How to call the method of bean of support on the component date. MinValue

    Hello

    I have a method in bean

    {} public void sample()

    Set the entry code

    }

    I want to call the sample method when I click the date component. MinValue in .jsff

    Right now using the < af:clientListener method = 'onClick' type = "click on" / > inside the < af:inputDate > element

    < af:resource type = "javascript" >

    function onClick (clickEvent) {}

    Alert ("hiii");

    Here, I want to call the sample method by clicking on date. MinValue

    }

    < / af:resource >

    Any Solution would be Appreciable

    Try to follow this:

    -Inside af: inputDate add clientListener and serverListener

    
         
         
    
    

    The serverListener method must map to a function in backbean

    -in java script method write this

    function onClick(event)
    {
      var source = event.getSource();
      AdfCustomEvent.queue(source,"serverListenerOperations", {}, false);
    }
    
  • sessionscope beans, calling the method

    "Win7 64 bit" JDeveloper 11g 11.1.1.7

    I have a workflow with page 2 and a callus of method. page 2 sail with a call to mettod to page 1.

    property method * method call is "#{sessionScope.Dd.assign_x}".

    DD is java bean. assign_x is the method to store a number on x.

    When I browse from page 2 to page 1 displays an error.

    Internal error 500 - Se

    javax.el.PropertyNotFoundException: Target Unreachable, 'Dd' returned null at com.sun.el.parser.AstValue.getTarget(Unknown Source) at com.sun.el.parser.AstValue.getMethodInfo(Unknown Source) at com.sun.el.MethodExpressionImpl.getMethodInfo(Unknown Source) at oracle.adf.controller.internal.util.ELInterfaceImpl.getReturnType(ELInterfaceImpl.java:214) at oracle.adfinternal.controller.activity.MethodCallActivityLogic.execute(MethodCallActivityLogic.java:135) at oracle.adfinternal.controller.engine.ControlFlowEngine.executeActivity(ControlFlowEngine.java:1068)

    How can I call a mettod and store a value in a Bean sessionScope?

    Thank you...

    Massage hiking you bean is not found.  Where you defined the bean to have a scope of session?

    In the adf, it should be done in the ADF - config.Xml. Once you have done you should not specify the scope of application as it is picked up automatically for the normal tasks of jsf.  Only for the adf glasses added, you specify the scope.

    Timo

  • Passing the params to the method AMImp to support bean

    Hello. I am a Jdeveloper/ADF Noob and I have a requirement where I created an AM method below and exposed to my view controller.

    I use this Jdeveloper 11.1.1.4 Doe.


    In AM
    ' public boolean createSRTask (String sourceName, number sourceRow)
    {
    Insert the new row in the object of the entity.
    EntityDefImpl SRTaskDef = MassSrImportEOImpl.getDefinitionObject ();
    MassSrImportEOImpl newSRTask = (MassSrImportEOImpl) SRTaskDef.createInstance2 (getDBTransaction (), null);
    newSRTask.setSourceName (sourceName);
    newSRTask.setSourceRow (sourceRow);
    Return (true);
    }

    I have a text file that I read and I get the parameters of the transformation of this file when the user press the upload button... I can loop through the contents of the file etc with no problems, but I still
    to understand how the bean support to call the AMImp method with the parameters that I read in the code.

    Thanks in advance for any help.

    Published by: 832187 on January 16, 2012 06:51

    Published by: 832187 on January 16, 2012 07:01

    In this case, you need to build a VO which is built on EO, add it to the data model of the module of the application. You can either implement the service method in the original Version or the module of the application. Suppose that you put in the AOS (application module) as you once did. the method it would look

    //In AM
        public boolean createSRTask(String sourceName, Number sourceRow) {
            ViewObjectImpl massView = (ViewObjectImpl)findViewObject("MassSrImportView1");
            Row row =  massView.createRow();
            row.setAttribute("Source", sourceName);
            row.setAttribute("SRCNR", sourceRow);
            massView.insertRow(row);
            return true;
        }
    

    Some note on this:
    1. the rows are not inserted in the comic book, as long as you do not post the transaction
    2. it doesn't look like your point of view is not a PK. The framework works best if you have a
    3. If you always return true, you can omit the return value completely
    4. If you plan to insert several lines, you should consider passing the file to the am method and a bulk insert in there it would reduce round trips.

    I highly recommend the that read the http://docs.oracle.com/cd/E25054_01/web.1111/b31974/bcintro.htm for more knowledge about the business layer.

    Timo

  • AM how to call the methods of class Impl EO

    Hello world

    I try to display database data in a table, and I need to add a transitional and calculated attribute.

    So I created an EO, I added a transitional attribute, and now I need to create the method that calculates its value.

    I created this method of AOS.

    Back to EO Impl class, I want to call this method in the Get accessor of my transitional attribute.

    To call this AM method in the EO Impl category, I have to get the AM, and I don't know how to do it. Because I'm used to getting the pageContext controller AM.

    I googled and found that I don't need to create the method in the AM, I found that I just have to code directly in the Get accessor.

    But again, to calculate my transitional attribute, I have need for some queries and for that I need OADBTransaction, which means once again, I need to get the AM in the Impl EO class.

    I'm confused, I don't know how to do, if anyone can help please

    Thank you

    Kind regards

    Afaf

    If you derive the value based on the query, it would be better to do it in a single query.

    If you can stick the main request and the subquery (s) here, I take a look.

    If this is not possible using the query, you can get the oaDBTransaction like below in the VO RowImpl.

    Import oracle.apps.fnd.framework.OAApplicationModule;

            OAApplicationModule appModule = (OAApplicationModule)this.getApplicationModule();
            appModule.getOADBTransaction()
    

    See you soon

    AJ

  • Calling the method

    Hello world

    Currently, I'm doing my own version of the ADT of stack. I have various methods including one called isEmpty(). It is perhaps an obvious question, but I want to use the method isEmpty() I created in all of my other methods that need it. For example, in the code below, I want to use it in the pop() method to test if the stack is empty, before I have to try to burst something from him. The problem is that it is not let me use the method I created and instead tells me to use .length as for a regular table. How can I do so that it allows me to use the method that I did? Any help appreciated, thanks.

    Sorry for the terrible copy paste btw, but I can't seem to be able to figure out how to paste the code with the lines and all.


    public class Stack < T > implements StackADT < T > {}

    Private [] T = table (new Object [] t [50]; object of type casts in [T])
    Private boolean doubleExpand = true; Original table expand

    {} public boolean isEmpty()

    for (T elem: array) {}
    If (elem! = null) {}
    Returns false;
    }
    }
    Returns true;

    }
    public T pop() {}

    If (array.isEmpty ()) {}
    code
    }
    }
    }

    Published by: 989888 on February 22, 2013 23:01

    I want to use the method isEmpty() I created in all of my other methods that need it.

    So call it.

    For example, in the code below, I want to use it in the pop() method to test if the stack is empty, before I have to try to burst something from him. The problem is that it is not let me use the method I created

    You didn't create it. You can't create methods in the classes in table.

    Instead it tells me to use .length as for a regular table.

    QED. It is a regular table. You are calling methods on a table, not only your own classes.

  • Is it possible to call the method in the PL/SQL AM?

    Hi all

    I have a really strange requirement, i.e. I want to know if I can call a method in an existing AM which is in the OPS database applications.

    Basically the method is called and worked very well for the controller but we also want to perform some batch process and want to know
    If you call the same method of PL/SQL somehow pass the parameters that we pass throgh the controller...?

    If this is not possible, can someone give me some alternatives... any help would be really appreciated.

    Thank you

    Hello

    Unable to correctly understand what you are trying to reach. But if you want to call a method of AM. What you can do is to join a competitor of Java program in Apps & then call this concurrent program front-end or via FND_REQUEST. SUBMIT_REQUEST... Front end you can even schedule this program too...

    It could be useful!

    Thank you
    AJ

  • Call the method from another application

    Then. That is my question. Is it possible to call a method from another application, so I can get some data from this app?

    I know that I could also do this with persistent store, but I would like to do it this way.

    Thank you. I'll try with world events and TIME store.

  • Error by calling the method on Bean managed from an other managed Bean

    Hello

    (Jdev 11.1.1.2.0)

    Help please:

    I have a managed bean (page scope of stream) that is used by my homepage for navigation of flow dynamic region:

    * / public class RegionNavigationBean implements Serializable {* +}
    private String dynamicTaskFlowId = "/ WEB-INF/home-task-flow-definition.xml#home-task-flow-definition"; +

    * public RegionNavigationBean() {* +}
    *}*

    * public TaskFlowId getDynamicTaskFlowId() {* +}
    Return TaskFlowId.parse (dynamicTaskFlowId); +
    *}*

    * public void setDynamicTaskFlowId (String taskFlowId) {* +}
    this.dynamicTaskFlowId = taskFlowId; +
    *}*
    *}*

    taskFlowId is set to the homepage def to + * ${pageFlowScope.regionNavigationBean.dynamicTaskFlowId} * +.

    In a table (i.e. display on my model layer object) DB I store a menu ID and a corresponding task_flow_id.

    Then I created a class of earphone action (RegionNavigationListener - scope of stream page) which I link to my menu on my main page items (property listener action on the item of menu = + * #{pageFlowScope.regionNavigationAction.processAction} * +)

    In this action (processAction method) listening port, I retrieve rowset in the VO menu and find the record that matches my menu ID that triggered the action event, recovering the task_flow_id that needs to be accessed.

    I then try to retrieve the instance of the RegionNavigationBean with the following statement: RegionNavigationBean regNav = (RegionNavigationBean) JSFUtils.getManagedBeanValue ("regionNavigationBean"); +.
    It seems to work fine, but as soon as I try to use it I get a NullPointerException error, for example:
    regNav.setDynamicTaskFlowId (menusRow.gettaskFlowId ()); +
    or:
    System.out.println ("%" + regNav.toString ()); +

    This is quite new to me... any help would be appreciated!

    Thank you
    Mario

    Hi Mario,.

    I tried following codes to get a bean managed in a region, it is very good for me.
    ManagedBean is the name of the class.

    FacesContext ctx = FacesContext.getCurrentInstance ();
    Application app = ctx.getApplication ();
    ManagedBean MB = (ManagedBean) app.evaluateExpressionGet (ctx, "#{pageFlowScope.managedBeanName}", ManagedBean.class);

    Todd

  • How to call the method of notification service websocket project different from the same application?

    Hi all

    My problem:

    * I have ADF application with model, view and websocket service inside projects.

    * I wish to inform the client (browser) on event triggered in the model project.

    * So, I need somehow to invoke the websocket service method to send the message to all the sessions that are enrolled in the websocket communication channel.

    * How can I achieve that?

    I use JDev 12.1.3 with built-in WebLogic Server. Thank you!

    -Danas

    No doubt with some form of messaging (JMS or something similar - in-memory cache solutions have pub/sub support).

    Dario

  • Calling the method perhaps undefined addChild

    When I use the addChild method in my class, I got this message. Why it says error "Call to addChild method maybe not set.

    OK, that's the rationale, add that and importation of movieClip in your class...

    When you extend any existing class object that does not contain an addChild method is used, therefore, this method does not exist.

    import flash.display.MovieClip;

    extends MovieClip...

    Add these two things to your class, and then try again.

Maybe you are looking for

  • where is add on option for new tab

    I don't have the + (plus) sign to add a new tab in the line of the tab. So, basically, I need to go to file and click "new tab". Not practical for me.

  • my old phone 4S is off, say, connect to itunes

    My old iPhone is off, say, connect to iTunes

  • Windows Update [error number: 0x8024400A]

    The website has encountered a problem and cannot display the page you are trying to view. [Error number: 0x8024400A]  This is the message that I get whenever I try to use windows update.  You have a solution.  Thank you. (merged thread)

  • code transfer signing key

    I installed a key on my VM of code signing, but now I want to use that same key on my host OS.  How can I transfer the key? ~ S

  • BlackBerry Smartphones battery swell - 9900

    When you do a battery pull to reset my phone I noticed that the back was correctly so I looked at the battery and noticed that the battery had inflated. I don't really mind, but my battery holds a charge. It lasts about 5 minutes, then he dies and tr