How to invoke method dynamically?

hai forum,
Plz let me know how do we invoke a dynamically choosen method method[ i ] of a class file by passing parameter array, para[ ].The structure of my code is shown below.. How will i write a code to invoke the selected method method?Plz help.
public void init()
public void SelectClass_actionPerformed(ActionEvent e)
//SELECT A METHOD method[ i ] DYNAMICALLY HERE
private void executeButton1_mouseClicked(MouseEvent e) {
//GET PARAMETERS para[ ] HERE.
//METHOD SHOULD BE INVOKED HERE
}//end of main class

Often,a nicer way would be to create an interface like "Callable" with one single "doMagic()" method, and different classes implementing this interface, instead of one class with different methods. Then simply load the class by name, call newInstance(), cast to Callable and invoke doMagic(). Keeps you away from most of the reflection stuff.

Similar Messages

  • How to invoke method from swing

    Aloha,
    Thanks in advance for help...
    I have created GUI, and want to use buttons to choose which Physics problem to solve. I have already coded the Physics in .java and have different methods for each one. I would like for the button to create an action that places the different problems on the panel, each with a section for information, given input and outputting the answers to solve for.
    public void actionPerformed(ActionEvent e)
         { // [20]
               String actionCommand = e.getActionCommand();
               if (e.getActionCommand().equals("Quiz 1"))
                 Quiz1();
               }Quiz1 is a private void method that calls on a helper method to perform calculations.
    When I use the above command, it invokes the method, but not on the GUI panel, it comes up on the DOS screen. What command should I use to place the calculations and information for this method on the GUI? I know I need to separate and create areas of the panel for input, etc. But I want the method to take place on the GUI.
    Thank you for your time and energy.

    Hi - I have a question now regarding using a single button, to collect data from multiple fields, make calculations and then return figures to multiple fields.
    I thought I could read them into two different variables (valueIn, valueIn2, etc) and then apply them to the JTextField variables. I was experimenting with just passing the initial figures without making calculations...
    But just trying with two different fields, the compiler gives me an error for an "unreachable statement". How do I collect from multiple sources and return separate answers to different fields?
    I tried to look up definitions for compiler messages, but couldn't find anything regarding "unreachable statements". Therefore, I would also appreciate any suggestions about a dependable source to reference errors.
    Thank you in advance for your assistance, I am attaching copy of code below...
    public class ChoiceFrame extends JFrame implements ActionListener
    { // [1]
         SolveIt converter = new SolveIt();
         public static final int WIDTH = 650;
      public static final int HEIGHT = 500;
      private JTextArea infoText;
      private double valueIn = 0;
      private double valueIn2 = 0; 
      private JTextField cliffHt;
      private JTextField deceleration;
      private JTextField timeFlight;
      private JTextField height;
      public static void main(String[] args)
      { // [2]
              ChoiceFrame myWindow = new ChoiceFrame();
              myWindow.setVisible(true);
         } // [2]
         public ChoiceFrame()
         { // [3]
              super( );
              setSize(WIDTH, HEIGHT);
              setTitle("ChoiceFrame");       
              Container contentPane = getContentPane();
              contentPane.setBackground(Color.BLUE);
              contentPane.setLayout(new BorderLayout());
              addWindowListener(new WindowDestroyer());                     
              JMenu memoMenu = new JMenu("File");
        JMenuItem file;
        file = new JMenuItem("Clear");
        file.addActionListener(this);
        memoMenu.add(file);
        file = new JMenuItem("Exit");
        file.addActionListener(this);
        memoMenu.add(file);
        JMenuBar mBar = new JMenuBar( );
        mBar.add(memoMenu);
        setJMenuBar(mBar);     
              JPanel northPanel = new JPanel();   
              northPanel.setLayout(new BorderLayout());          
              JPanel textPanel = new JPanel();          
        northPanel.add(textPanel, BorderLayout.WEST);       
              infoText = new JTextArea (8, 43);
              infoText.setBackground(Color.WHITE);
              infoText.setLineWrap(true);
              textPanel.add(infoText);
        infoText.setText("The Coyote, in his relentless attempt to catch the elusive Road Runner,\nloses his footing and falls from a sheer cliff ___ meters above the ground.\nAfter falling for __ seconds (without friction), the Coyote remembers that\nhe is wearing his Acme rocket-powered backpack, which he immediately turns on.\nThe Coyote makes a gentle landing (zero velocity) on the ground below,\nbut is unable to turn off the rocket, and is immediately propelled back up into the air.\n___ seconds after leaving the ground, the rocket runs out of fuel.\nAfter continuing upwards for a ways, the poor Coyote plunges back to the ground.");
              JPanel inputPanel = new JPanel();          
        northPanel.add(inputPanel, BorderLayout.EAST);      
              inputPanel.setLayout(new GridLayout(3,2));     
              cliffHt = new JTextField(5);
              inputPanel.add(cliffHt);
              JLabel mtrsLabel = new JLabel("meters");
              inputPanel.add(mtrsLabel);
              JTextField secondsf = new JTextField(5);
              inputPanel.add(secondsf);
              JLabel sfLabel = new JLabel("seconds falling");
              inputPanel.add(sfLabel);
              timeFlight = new JTextField(5);
              inputPanel.add(timeFlight);
              JLabel sFlightLabel = new JLabel("seconds in flight");
              inputPanel.add(sFlightLabel);          
              JPanel southPanel = new JPanel();          
              southPanel.setLayout(new BorderLayout());          
              JPanel buttonPanel = new JPanel();
              buttonPanel.setLayout(new FlowLayout());
              JButton calcButton = new JButton("Calculate");
              calcButton.addActionListener(this);
              buttonPanel.add(calcButton);
              southPanel.add(buttonPanel, BorderLayout.NORTH);
              JPanel outputPanel = new JPanel();
           outputPanel.setLayout(new GridLayout(3,2));          
              JLabel decelLabel = new JLabel("With the rocket backpack turned on, the deceleration is: ");
              outputPanel.add(decelLabel);
              deceleration = new JTextField(10);
              outputPanel.add(deceleration);
              JLabel htLabel = new JLabel("the max height is: ");
              outputPanel.add(htLabel);
              height = new JTextField(10);
              outputPanel.add(height);
              JLabel vLabel = new JLabel("the velocity is: ");
              outputPanel.add(vLabel);
              JTextField velocity = new JTextField(10);
              outputPanel.add(velocity);          
           southPanel.add(outputPanel, BorderLayout.CENTER);
              contentPane.add(northPanel, BorderLayout.NORTH);                         
              contentPane.add(southPanel, BorderLayout.CENTER);     
         } // [3]
         public void actionPerformed(ActionEvent e)
         { // [20]
              String actionCommand = e.getActionCommand();
              if (e.getActionCommand().equals("Calculate"))
                        deceleration.setText(Quiz1());
                        height.setText(Quiz1());
              else if (e.getActionCommand().equals("Close"))
                   System.exit(0);
              else if (actionCommand.equals("Exit"))
          System.exit(0);
         } //[20]
         private String Quiz1()
         { // [40]
              SolveIt calculate = new SolveIt();
              double gravity = 9.81;
              double initialSpeed = 0;
              double freeFall = 5; //this is time for freefall in seconds
              valueIn = stringToDouble(cliffHt.getText());
              return Double.toString(valueIn);     
              valueIn2 = stringToDouble(timeFlight.getText());          
              return Double.toString(valueIn2);
         } // [40]     
         private static double stringToDouble(String stringObject)
         { // [30]
              return Double.parseDouble(stringObject.trim());
         } // [30]

  • Java.lang.NoSuchMethodException when invoke method dynamic

    hi!
    i have some trouble when i invoked hibernate PO class method dymaic by parameters, here is a piece of code, can someone help me? thanks in advance! please!
    String fieldname = field.getName().toLowerCase();
    String methodName = "get" + fieldname.replaceFirst(fieldname.substring(0, 1),fieldname.substring(0,1).toUpperCase());
    Method methodFinal;
         try {
         methodFinal = value.getClass().getDeclaredMethod(methodName, new Class[] {PaymentPO.class});
         return methodFinal.invoke(value, null);
         } catch (SecurityException e) {
              e.printStackTrace();
         } catch (NoSuchMethodException e) {
              e.printStackTrace();
         } catch (IllegalArgumentException e) {
              e.printStackTrace();
         } catch (IllegalAccessException e) {
              e.printStackTrace();
         } catch (InvocationTargetException e) {
              e.printStackTrace();
         }

    I don't know what your error is, but here are a few suggestions:
    * print out the method name.
    * print out the methods for the class on which you're trying to invoke the method
    * rather than trying to use this means of invoking a property getter, look into some of the javabeans introspection classes:
    http://java.sun.com/j2se/1.5.0/docs/api/java/beans/Introspector.html
    http://java.sun.com/j2se/1.5.0/docs/api/java/beans/BeanInfo.html
    http://java.sun.com/j2se/1.5.0/docs/api/java/beans/PropertyDescriptor.html

  • Invoke method dynamically  based on string name.

    In my code i have some 50 odd if else condition:
    if(command.equals("abc"))
    //call abc method
    abc();
    else if(command.equals("xyz"))
    // call xyz();
    and so on........
    now based on command string i need to call a method whose name is identical to command string.
    I have used reflection to do this and it works. But just need to know ,
    is there any other approach available?
    Also, it is better to use reflection or just write 50 if else statements and call each function.
    TIA,
    Sachin

    hey i asked the same question a little while ago and got some
    very good feedback at this thread
    http://forum.java.sun.com/thread.jspa?threadID=646255
    i had written some test code but i cant find it.
    you will be looking for this kind of stuff though
    (this isnt intelligible code)
    Object o = Class.forName("hto");
    Field[] fields = ht.getClass().getDeclaredFields();
    Class class1 = ( fields[1].getType() );
    Class class2 = Class.forName("MyClassName");
    Class[] param = { value.getClass() };
    Object[] invokeParam = { value };
    Class[] prim = { Class.forName("HackThis") };
    Method method = ht.getClass().getMethod("set" + var, param);
    method.invoke(ht, invokeParam);

  • How to invoke methods from an other class?

    Hello,
    I've got the following problem I can't solve:
    I have a class that extends JApplet (viewtiff) and another that displays the images (DisplayJAI). Now I have implemented the MouseListener in DisplayJAI and on a right-click it should execute a method located in viewtiff.
    If viewtiff would be created by myself with the new operator, this wouldn't be a problem. I just had to write instance_name.method() to invoke it, but in this case I don't know the instance name of my viewtiff class because it gets created by the JApplet I think.
    Defining viewtiff static would help, but this isn't possible for the 'main' class in an applet. What can I do now?
    Many thanks,
    Sebastian Tyler

    in the constructor// in ViewApplet:
    ViewTIFF vt = new ViewTIFF (this);
    // in ViewTIFF:
    class ViewTIFF {
    private ViewApplet va;
    public ViewTIFF (ViewApplet va) {
    this.va = va;
    void someMethod () {
    va.someMethod ();
    }>> a setter method// in ViewApplet:ViewTIFF vt = new ViewTIFF ();
    vt.setViewApplet (this);
    // in ViewTIFF:
    class ViewTIFF {
    private ViewApplet va;
    public void setViewApplet (ViewApplet va) {
    this.va = va;
    void someMethod () {
    va.someMethod ();

  • How to invoke method BEFORE a window event occurs

    Hi all,
    I didn't get may results searching for this.
    I have two windows open - one is a JFrame and the other is an overlay. I would like the overlay to go down BEFORE the windowIconified (window minimized) event. However, the window listener for that event only happens AFTER the window is iconified. Is there any way to do this? In other words, I want to invoke my methods to take down the overlay BEFORE the JFrame is minimized.
    Is there any way this can be done?
    Any help would be greatly appreciated.
    Thanks,
    JB

    The problem is that the windowIconified windowListener occurs AFTER the JFrame has been minimized. Here is the timeline that occurs: User minimizes the window -> windowListener:windowIconified is invoked -> overlay is brought down.
    Here is the timeline that I want:
    User clicks on minimizes -> overlay is brought down -> window is ACTUALLY minimized here

  • Invoke a method dynamically

    Hi,
    I want to invoke a method dynamically. I have the class name and method name in a variable and the list of import and export parameter for this method in an internal table. Now I need to invoke this method dynamically i.e. without having it to call in code like this classname->methodname(.....). I want something like reflection in java, where we can call the method using invoke method of method class ex:
    try {
    Method method = cls.getMethod( "setColor",
    new Class[] {Color.class} );
    method.invoke( obj, new Object[] );
    It would be helpful if you can provide a simple example on how it can be implemented in ABAP.
    Thanks,
    Raghavendra

    Hi,
         You can perform calls in that way as follows.
    You need to pass the parameters usingthe following table of type ABAP_PARAMBIND_TAB.
    DATA: ptab type ABAP_PARAMBIND_TAB,
               ptab_line like line of ptab.
    DATA: clas_name type stirng VALUE 'CLASS_NAME',
               method_name type string VALUE 'METHOD_NAME'.
    DATA: obj  type ref to OBJECT.
    create object obj type class_name.
    ptab_line-name = 'PARAM_NAME'.
    ptab_line-kind = CL_ABAP_OBJECTDESCR=>EXPORTING.
    Then you can use
    CALL METHOD  obj->(method_name) PARAMETER-TABLE ptab.
    Regards,
    Sesh

  • Dynamically invoke methods of abstract class?

    Hi,
    I am using reflection to write a class (ClassA) to dynamically invoke methods of classes. I have an abstract class (ClassB) that has some of the methods already implemented, and some of the methods that are declared abstract. Is there any way that I can:
    (a) invoke the methods that are already implemented in ClassB;
    (b) I have another class (ClassC) that extends ClassB, some of the methods are declared in both classes. Can I dynamically invoke these methods from ClassB?
    Thanks in advance,
    Matt.

    Ok, the program is quite long, as it does other things as well, so I'll just put in the relevant bits.
    What I have is a JTree that displays classes selected by the user from a JFileChooser, and their methods.
    // I declare a variable called executeMethod
    private static Method executeMethod;
    // objectClass is a class that has been chosen by the user.  I create a new instance of this class to execute the methods.
    Object createdObject = objectClass.newInstance();
    // methodName is the method selected by the user.  objectClassMethods is an array containing all the methods in the chosen class.
    executeMethod = objectClassMethods[j].getDeclaringClass().getMethod(methodName, null);
    Object executeObject = executeMethod.invoke(createdObject, new Object[]{});Ok, here are the test classes:
    public abstract class ClassB{
         private int age;
         private String name;
         public ClassB(){ age = 1; name="Me";}
         public int getAge(){ return age; }
         public String getName(){ return name; }
         public void PrintAge(){System.out.println(age);}
         public void PrintName(){System.out.println(name);}
         public abstract void PrintGreeting();
    public class ClassC extends ClassB{
         public ClassC(){super();}
         public void PrintAge(){
              System.out.println("I am " + getAge() + " years old.");
         public void PrintGreeting(){
           System.out.println("Hello");
    }Now, I can print out the PrintAge method from ClassC (i.e. have it output "Hello" to the command line, how can I, say, get it to output the result of PrintName from ClassB, this method does not appear in ClassC. As you can see at the top, I can create a new instance of a normal method (in this case, ClassC), and have it output to the command line, but I know that I can't create a new instance of an abstract class. And since PrintName is implemented in abstract class ClassB, how do I get it to output to the command line?
    Thanks,
    Matt.

  • Silverlight, wcfRIA, how to trap completion of an [Invoke] method in DomainService1.cs

    this piece of code:
    protected void recalculateMetrics(object sender, RoutedEventArgs e)
    int daysToAverageOver = 20; // for a 20 day moving average
    context.recalculateMetrics(daysToAverageOver, invokeOperation_ExitHandler, null);
    context.deleteOldClosingPrices(invokeOperation_ExitHandler, null);
    context.deleteAnyOldStockNames(invokeOperation_ExitHandler, null);
    context.updateAllPortfolios(invokeOperation_ExitHandler, null);
    context.updateTheCountersInAllPortfolios(nowRefreshScreen_ExitHandler, null);
    context.zeroOutAnyUnaverageableStocks(daysToAverageOver, invokeOperation_ExitHandler, null);
    context.SubmitChanges();
    context.SendEmails();
    context.Load<stk_StockNames>(context.getMissingStockNamesQuery(), LoadBehavior.RefreshCurrent, returnSet =>
    fires off a whole bunch of [Invoke] methods in DomainService1.cs, which all execute asynchronously.
    Once updateAllPorfolios() and updateThe CountersInAllPortfolios () are completed, then the client screen should refresh with the new numbers.  You can see me trapping the completion event of the Invoke operation.  But how do I trap the completion
    of the actual async method?  I figure that IAsyncResult is involved.  I have googled around all the forums without being able to see how to do it in this particular case.
    Any help appreciated.

    I don't really follow your question.
    You appear to be supplying callbacks there.
    They fire when the process is complete and you get a result back from the server.
    If I illustrate this with a piece of my code thus:
    private void LoadSites()
    siteService.LoadSiteList(LoadSiteListCallback, null);
    private void LoadSiteListCallback(ServiceLoadResult<Site> result)
    IEnumerable<Site> _sites = result.Entities.OrderBy(x => x.Description);
    ObservableCollection<Site> sts = new ObservableCollection<Site>();
    foreach (var item in _sites)
    sts.Add(item);
    Sites = sts;
    ADGroupSites = new ObservableCollection<AdminADGroupSiteVM>();
    RaisePropertyChanged("Sites");
    RaisePropertyChanged("ADGroupSites");
    LoadSiteList is called asynchronously.
    Processing returns from LoadSites.
    When the server returns the data LoadSiteListCallback is invoked and it does stuff with the data.
    Please don't forget to upvote posts which you like and mark those which answer your question.
    My latest Technet article - Dynamic XAML

  • How to invoke a method in application module or view objects interface?

    Hi,
    perhaps a stupid RTFM question, but
    How can i invoke a method that i have published in the application modules or view objects interfaces using uiXml with BC4J?
    Only found something how to invoke a static method (<ctrl:method class="..." method="..." />) but not how to call a method with or without parameters in AM or VO directly with a uix-element.
    Thanks in advance, Markus

    Thanks for your help Andy, but i do not understand why this has to be that complicated.
    Why shall i write a eventhandler for a simple call of a AM or VO method? That splatters the functionality over 3 files (BC4J, UIX, handler). Feature Request ;-)?
    I found a simple solution using reflection that can be used at least for parameterless methods:
    <event name="anEvent">
      <bc4j:findRootAppModule name="MyAppModule">
         <!-- Call MyAppModule.myMethod() procedure. -->
          <bc4j:setPageProperty name="MethodName" value="myMethod"/>
          <ctrl:method class="UixHelper"
                  method="invokeApplicationModuleMethod"/>
       </bc4j:findRootAppModule>
    </event>The UixHelper method:
      public static EventResult invokeApplicationModuleMethod( BajaContext context,
                                                               Page page,
                                                               PageEvent event ) {
        String methodName = page.getProperty( "MethodName" );
        ApplicationModule am = ServletBindingUtils.getApplicationModule( context );
        Method method = null;
        try {
          method = am.getClass(  ).getDeclaredMethod( methodName, null );
        } catch( NoSuchMethodException e ) {
          RuntimeException re = new RuntimeException( e );
          throw re;
        try {
          method.invoke( am, null );
        } catch( InvocationTargetException e ) {
          RuntimeException re = new RuntimeException( e );
          throw re;
        } catch( IllegalAccessException e ) {
          RuntimeException re = new RuntimeException( e );
          throw re;
        return null;
      }Need to think about how to handle parameters and return values.
    Btw. Do i need to implement the EventHandler methods synchronized?
    Regards, Markus

  • Urgent please ! How to invoke java method with diffrent argument types?

    Hi,
    I am new to JNI.
    I had gone through documentation but it is not of much help.
    Can any one help me out how to invoke the below java method,
    // Java class file
    public class JavaClassFile
    public int myJavaMethod(String[] strArray, MyClass[] myClassArray, long time, int[] ids)
    // implementation of method
    return 0;
    // C++ file with Invokation API and invokes the myJavaMethod Java method
    int main()
    jclass cls_str = env->FindClass("java/lang/String");
    jclass cls_MyClass = env->FindClass("MyClass");
    long myLong = 2332323232;
    int intArray[] = {232, 323, 32, 77 };
    jclass cls_JavaClassFile = env->FindClass("JavaClassFile");
    jmethodID mid_myJavaMethod = env->GetMethodID( cls_JavaClassFile, "myJavaMethod", "([Ljava/lang/String;[LMyClass;J[I)I");
    // invoking the java method
    //jint returnValue = env->CallIntMethod( cls_JavaClassFile, mid_myJavaMethod, stringArray, myClassArray, myLong, intArray ); --- (1)
    //jint returnValue = env->CallIntMethodA( cls_JavaClassFile, mid_myJavaMethod, ...........); --- (2)
    //jint returnValue = env->CallIntMethodV( cls_JavaClassFile, mid_myJavaMethod, ...........); --- (3)
    Can any one tell me what is the correct way of invoking the above Java method of (1), (2) and (3) and how ?
    The statement (1) is compilable but throws error at runtime, why ?
    How can I use statements (2) and (3) over here ?
    Thanks for any sort help.
    warm and best regards.

    You are missing some steps.
    When you invoke a java method from C++, the parameters have to be java parameters, no C++ parameters.
    For example, your code appears to me as thogh it is trying to pass a (C++) array of ints into a java method. No can do.
    You have to construct a java in array and fill it in with values.
    Here's a code snippet:
    jintArray intArray = env->NewIntArray(10); // Ten elments
    There are also jni functions for getting and setting array "regions".
    If you are going to really do this stuff, I suggest a resource:
    essential JNI by Rob Gordon
    There is a chapter devoted to arrays and strings.

  • How to invoke AM method that accepts parameter other than string

    Hi
    I need to pass 2 date parameters to my AM method.
    I checked the jdev doc and found the below method that can be used for any of the parameter other than String
    public Serializable invokeMethod(String methodName,
    Serializable[] methodParams,
    Class[] methodParamTypes)
    one thing i am not able to understand is how to pass multiple dates in a single Class parameter.
    can anyone tell me the invoke method syntax for passing 2 dates.

    Hi,
    Suppose you have a string and two date parameters
    String test;
    Date date1;
    Date date2;
    then pass it like this
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    Serializable parameters[] = {test,date1,date2};
    Class paramTypes[] = {String.class,Date.class,Date.class};
    am.invokeMethod("initSummary", parameters, paramTypes);
    Thanks,
    Gaurav

  • How to invoke a class or methods simultaneously

    Hi
    how can an class object or method invoke simultaneously for n numbers.
    eg:
    invoke() // method to be invoked 5 numbers
    praks

    What do you mean? You want to start 5 threads at the same time? You can start them and let them wait on an object. Then you call notifyAll. It think this is the closest to a simultaneous start you can get.

  • How to invoke the InnerClass method?

    Hi,
    could you please tell how to invoke the method of innerclass in the below example?
    public class OuterClass {
    final String s = "I am outer class member variable";
    public void Method() {
    String s1 = "I am inner class variable";
    class InnerClass {
    public void innerMethod() {
    int xyz = 20;
    System.out.println(s);
    System.out.println("Integer value is" + xyz);
    System.out.println(s1); // Illegal, compiler error
    public static void main(String args[])
          OuterClass2 outer = new OuterClass2();
          outer.outerMethod();
    //      outer.Method().InnerClass inner = new InnerClass(); :-( :-(
    //      out.innerMethod(); :-( :-(
    }

    Pannar wrote:
    kajbj wrote:
    As I said. InnerClass.innerMethod can't be invoked from main. It can only be invoked from within outerMethod.
    KajThats what i wanted. plz specify the line of code which descibes invoking innerMethod() from outerMethod. i wanted to see that line of code. :-)
    public class OuterClass2 {
        private String s = "I am outer class member variable";
        public void outerMethod() {
            final String s1 = "I am inner class variable";
            class InnerClass {
                public void innerMethod() {
                    int xyz = 20;
                    System.out.println(s);
                    System.out.println("Integer value is" + xyz);
                    System.out.println(s1);
            new InnerClass().innerMethod();
        public static void main(String args[]) {
            OuterClass2 outer = new OuterClass2();
            outer.outerMethod();
    }

  • Question on "How-to invoke a method once upon application start"

    Hello everyone.
    I'm trying to implement what the article "How-to invoke a method once upon application start" by Frank suggests.
    https://blogs.oracle.com/jdevotnharvest/entry/how_to_invoke_a_method
    Suppose that I'm having a single point of entry, so in my login.jpsx I have the below:
    <f:view beforePhase="#{login.onBeforePhase}">In the method "onBeforePhase" I have to pass the phaseEvent, since the signature is the following:
    public void onBeforePhase(PhaseEvent phaseEvent)but how do I know the phaseEvent when calling the login.onBeforePhase? How the call should be?
    Thanks a lot!
    ps. I'm using jDev 11.1.2.1.0

    You need not pass anything to this method , this method will get called before every Phase except ReStore View
    Just write the logic as Frank suggested for the phase in which you want the code to execute. You can get the PhaseId's like
    PhaseId.RENDER_RESPONSE
    public void onBeforePhase(PhaseEvent phaseEvent) {// from Frank's doc
    //render response is called on an initial page request
      if(phaseEvent.getPhaseId() == PhaseId.RENDER_RESPONSE){
    ... etc

Maybe you are looking for

  • Filename problem

    What I wish to do is to name the file that I'm writing to with todays date and time (eg. 2009.08.13 09:15.txt). With the following code, the file name is truncated to be "2009.08.13 09". Thanks in for looking.     private void writeLog()         File

  • Session Management in JSP

    Hi All, I am using servlet to hold the session values(Login) and in JSP page I am killing the session values and then redirecting to Login page.The Problem I am facing is that the Session values are retained eventhough I sign off , ie by navigating b

  • Controller references

    Hi All, I have very basic doubts regarding Webdynpro classes and mehods. Im new to ABAP objects also. 1) First of all if I'm writing any program, i should know what are the standard classes and methods available for this scenario, How to find this...

  • Slow RAM Preview in CC, any suggestions?

    I am running my CC on a Windows 8.1 OS, with 24 GB RAM, an EVGA GeForce GTX 760 4GB graphics card, and i7 3570k Quad Core 3.4GHz processor. However, I am still experiencing an issue with struggling RAM preview. I've also altered the cuda supported ca

  • Searching for international top music charts

    I'm getting very frustrated in my search for international hits. I go to the bottom of the itunes store page and click other country but most of the other countries only have the most popular apps.Day by day my frustration grows. It used to be so eas