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

Similar Messages

  • How to use " toFront() " method in java application and in which package or

    How to use " toFront() " method in java application and in which package or class having this toFront() method.if anybody know pl. send example.

    The API documentation has a link at the top of every page that says "Index". If you follow that and look for toFront(), you will find it exists in java.awt.Window and javax.swing.JInternalFrame.
    To use it in a Java application, create an object x of either of those two classes and write "x.toFront();".

  • 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

  • How to invoke action method from mail contained link

    Hello,
    my application needs to send mails to users that include links for the user to click on. Something like www.mysite.com/displayData.jsp&id=123. My question is now how I make JSF invoke the respective method in the backed bean to display the data with the id 123 when the user clicks on the link int the mail.
    I wonder whether there is some kind of "catch-all action" that checks whether the user is logged in and authorized whenever any JSP page is invoked. I'm a bit tired of first checking the authorization of some user before processing the remaining part od the backed bean's action method.
    Thanks for any hints,
    Oliver Plohmann

    my application needs to send mails to users that
    include links for the user to click on. Something
    like www.mysite.com/displayData.jsp&id=123. My
    question is now how I make JSF invoke the respective
    method in the backed bean to display the data with
    the id 123 when the user clicks on the link int the
    mail.I dont think there is a way to submit to an action on click of a link. Only possible solution is to invoke the method from the constructor of your Backing Bean and populate the bean fields displayed on your page.
    I wonder whether there is some kind of "catch-all
    action" that checks whether the user is logged in and
    authorized whenever any JSP page is invoked. I'm a
    bit tired of first checking the authorization of some
    user before processing the remaining part od the
    backed bean's action method. You can try out a Servlet filter for doing this.

  • 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 the method for af:cmdtoorbarbtn having af:showpopbehavior

    Hi,
    Please help me to invoke the method on click the &lt;af:commandToolbarButton&gt; which having &lt;af:showPopBehavior&gt; as child tag.
    Here the code snippet:-
    &lt;af:commandToolbarButton icon="/icons/field_group_plus_ena.png"
    hoverIcon="/icons/field_group_plus_ovr.png"
    depressedIcon="/icons/field_group_plus_dwn.png"
    disabledIcon="/icons/field_group_plus_dis.png"
    shortDesc="#{bundle.ADD_TAG}"
    useWindow="true"&gt;
    &lt;af:showPopupBehavior popupId="popupDialogForEditTagConf"/&gt;
    &lt;/af:commandToolbarButton&gt;
    &lt;af:popup id="popupDialogForEditTagConf"&gt;
    &lt;af:dialog title="#{bundle.SELECT_TAG}"
    dialogListener="#{TagHelper.selectTagDialogCB}"&gt;
    &lt;f:facet name="buttonBar"/&gt;
    &lt;af:panelCollection featuresOff="detach"&gt;
    &lt;f:facet name="menus"/&gt;
    &lt;f:facet name="toolbar"/&gt;
    &lt;f:facet name="statusbar"/&gt;
    &lt;af:treeTable value="#{bindings.tagTree.treeModel}"
    var="it" disableColumnReordering="true"
    rowSelection="single" rowBandingInterval="1"
    columnStretching="false" id="TagTree"
    binding="#{TagHelper.tagTree}"&gt;
    &lt;f:facet name="nodeStamp"&gt;
    &lt;af:column sortable="false"
    headerText="#{bundle.TAG_NAME}"
    width="250"&gt;
    &lt;af:outputText value="#{it.name}"/&gt;
    &lt;/af:column&gt;
    &lt;/f:facet&gt;
    &lt;af:column sortable="false" width="250px"
    headerText="#{bundle.DESCRIPTION}"&gt;
    &lt;af:outputText value="#{it.description}"/&gt;
    &lt;/af:column&gt;
    &lt;/af:treeTable&gt;
    &lt;/af:panelCollection&gt;
    &lt;/af:dialog&gt;

    Hi,
    you cannot invoke the showPopupBehavior component action programatically. Instead, to programatically launch a popup, you use client side JavaScript as explained in the WebDeveloper guide http://download.oracle.com/docs/cd/E12839_01/index.htm . Note that the JavaScript can be launched from a managed bean
    Frank

  • How to update payment method,once generated payment doc through F-58.

    Hi Experts,
    I want to update payment method,once generated payment doc through F-58.
    1)Maintained payment method in XK01
    2)Maintained the same in Invoice Number
    But, i am not able to generate payment method in payment doc through f-58.
    It can possble through F110,but why not in F-58.
    Please let me know,whether is it possible or not.
    Thanks
    Kishore.J

    Hi Ravi,
    Thanks for your reply.
    I gave my payment method,bank and check lot details in F-58 and generated payment document f-58.But,i am not able to find payment method in payment document.
    Thanks
    Kishore.J

  • How to invoke a method in JApplet from javascript.

    We want to invoke a method in JApplet from javascript.
    with the help Java Plug-in HTML Converter Version 1.3, we have generated OBJECT/EMBED tag for
    the following applet tag.
    <APPLET CODE = "SimpleApplet" WIDTH = 200 HEIGHT = 300 NAME = "simpleApplet"
    MAYSCRIPT = true>
    <PARAM NAME = "p1" VALUE = "v1">
    </APPLET>
    it is given the following code
    <!--"CONVERTED_APPLET"-->
    <!-- CONVERTER VERSION 1.3 -->
    <OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
    WIDTH = 200 HEIGHT = 300 NAME = "simpleApplet"
    codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0">
    <PARAM NAME = CODE VALUE = "SimpleApplet" >
    <PARAM NAME = NAME VALUE = "simpleApplet" >
    <PARAM NAME = MAYSCRIPT VALUE = true >
    <PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
    <PARAM NAME="scriptable" VALUE="false">
    <PARAM NAME = "p1" VALUE = "v1">
    <COMMENT>
    <EMBED type="application/x-java-applet;version=1.3" CODE = "SimpleApplet" NAME =
    "simpleApplet" WIDTH = 200 HEIGHT = 300 MAYSCRIPT = true p1 = "v1" scriptable=false
    pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html"><NOEMBED></COMMENT>
    </NOEMBED></EMBED>
    </OBJECT>
    <!--
    <APPLET CODE = "SimpleApplet" WIDTH = 200 HEIGHT = 300 NAME = "simpleApplet"
    MAYSCRIPT = true>
    <PARAM NAME = "p1" VALUE = "v1">
    </APPLET>
    -->
    <!--"END_CONVERTED_APPLET"-->
    But, even after trying to invoke method in the JApplet from javascript, it is not being invoked in
    Netscape. it is being invoked from
    IE after changing the scriptable = true. Is there any such parameter to change, to invoke the
    method in JApplet from javascript?
    can anybody give any suggestion?

    hi there,,
    well the same problem exists with my code also, NS fails to call the function from java applet... if u get the answer please mail me on [email protected]

  • How to invoke bean method after query executed?

    Jdeveloper 11.1.1.2:
    I have a bean that backs a JSF page.
    The bean has a method that shows/hides certain GUI components based on the values of other components.
    I would like to invoke this method automatically after the page has been fully loaded.
    I tried invoking the method in the AfterPhase of the f:view and at bean construction time. Both approaches failed.
    I think I need a listener that gets invoked after the query has been executed.
    Any idea?
    thanks

    Hi,
    if the bean is a backing bean and it is supposed to hide components, then why don't you create a reference of the components to the backing bean so that the displayed property is dynamically evaluated ? Sounds like this is what you want to do
    Frank

  • How to show asterisk * effect once the user starts editing the document??

    I wrote a java text editor. I creat a new internal frame and allows to open a document.
    How to have an effect (an asterisk * follows the filename in title bar) once
    the user starts editing the document? And once I save that file, that asterisk * will
    disappear. It seems to me we need to add a listener, but not sure how to change
    the title bar of internal frame??

    just use DocumentListener like
    myTextArea.getDocument().addDocumentListener(new DocumentListenet(){
    public void changedUpdate(DocumentEvent e){
    frame.setTitle( frame.getTitle() + "*" );
    implements two other methods too

  • HT1338 I am unable to update Pages and Numbers  because I changed my Apple ID, being I could not remember my password and security questions. How can I now update  these two applications?

    I am unable to uodate Pages and Numbers sice I changed my Apple ID, because I forgot my password and other security information. How I do I now update these applications. The system is asking for my Old Apple ID.
    Also  i am unable to activitate icloud. I did not receive a verication email. How can this issue be addressed?
    Regards,
    P.S. my email address is [email protected]

    https://iforgot.apple.com/cgi-bin/WebObjects/DSiForgot.woa/wa/iforgot?app_type=e xt&app_id=93&returnURL=https://appleid.apple.com/cgi-bin/WebObjects/MyAppleId.wo a&language=US-EN

  • 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 Java method from C++

    Hi
    My requirement is In C++ we are having three different structures, like
    struct one{
    int accontno;
    char * accountholdername;
    long balance;
    struct two{
    int startdate;
    int enddate;
    struct three{
    char* userid;
    char* userpassword;
    from c++ how to pass these structures, these structures I have to read in Java class, and in java how receive these structures.
    And the sample methods will be like: getCarsData(Input, output, Error);
    How do i call the method in JNI, if it is static int method we can call like
    getStaticIntMethodID(), instead of int if i have to pass the above mentioned structures how do i do? Should i create an object array in JNI for accessing these three structures?
    Suggestions/Samples welcome
    Thanks,

    Why did you start another thread for this?
    I was answering you in the [url http://forum.java.sun.com/thread.jspa?threadID=712137&messageID=4119725#4119725]old thread and you didn't even bother to answer back my (basic) questions.
    I told you to use the code tags when pasting code. Got ignored. I also gave you a starting example on how to achieve your goal. Flushed.
    Oh well, I'm getting used to it.
    Again.
    Before starting, allways keep near you the [url http://java.sun.com/j2se/1.5.0/docs/guide/jni/spec/jniTOC.html]JNI reference. All the JNI functions are documented in it.
    First you need to create custom Java classes that will match the C++ stucts (remember?).
    There is no magic wand in JNI that will transform the C++ structs into the custom Java classes and vice versa.
    You'll have to code it by hand, one field at a time. It's a pain.
    So for the one, two, three C++ structs (why not posting some real names instead of this &#99;&#114;&#97;&#112;?),
    there will be JOne, JTwo and JThree Java classes.
    There is also that other Java class already existing with getCarsData() static method that will fetch the data.
    And finally the DLL function wich will call this Java static method, doing the bridge between the C++ structs and the custom Java classes, finally return the data.
    Due to the lack of explanation from your posts, I will say that the getCarsData() static method receives a parameter of type JOne
    and returns an array of JTwo objects.
    So the get_cars_data() DLL function receives a parameter which is a struct one and
    returns a pointer to an array of struct two elements.
    // C++ structs
    struct one {
        int accontno;
        char * accountholdername;
        long balance;
    struct two {
        int startdate;
        int enddate;
    struct three {
        char * userid;
        char * userpassword;
    // custom Java classes
    class JOne {
        int accontno;
        String accountholdername;
        int balance;
    class JTwo {
        int startdate;
        int enddate;
    class JThree {
        String userid;
        String userpassword;
    // Java class with static method that gets the data
    class DataFetcher {
        static JTwo[] getCarsData(JOne one) {
    // DLL function
    // struct 'one' parameter is already filled with values.
    // Returns an array of 'two' C++ struct obtained from a Java static method
    two * get_cars_data(one o) {
        JNIEnv * env;
        /** not show here is the code to either
            create the JVM or
            attach it to the current thread **/
        // get the data from 'one' C++ struct and put it in a new instance of JOne Java class
        jclass oneCls = env->FindClass("JOne");
        jmethodID oneCtorID = env->GetMethodID(oneCls, "<init>", "()V");
        jfieldID accontnoID = env->GetFieldID(oneCls, "accontno", "I");
        jfieldID accountholdernameID = env->GetFieldID(oneCls, "accountholdername", "Ljava/lang/String;");
        jfieldID balanceID = env->GetFieldID(oneCls, "balance", "I");
        jobject oneObj = env->NewObject(oneCls, oneCtorID);
        env->SetIntField(oneObj, accontnoID, o.accontno);
        env->SetObjectField(oneObj, accountholdernameID, env->NewStringUTF((const char *)o.accountholdername));
        env->SetIntField(oneObj, balanceID, o.balanceo);
        // call the Java static method
        jclass dfCls = env->FindClass("DataFetcher");
        jmethodID getCarsDataID = env->GetStaticMethodID(dfCls, "getCarsData", "(LJOne;)[LJTwo;");
        jobjectarray twoArray = (jobjectarray)env->CallStaticObjectMethod(dfCls, getCarsDataID, oneObj);
        // create the 'two' C++ struct array from the Java array of JTwo objects
        jclass twoCls = env->FindClass("JTwo");
        jfieldID startdateID = env->GetFieldID(twoCls, "startdate", "I");
        jfieldID enddateID = env->GetFieldID(twoCls, "enddate", "I");
        jint len = env->GetArrayLength(twoArray);
        two * pt = new two[len];
        for (int i = 0; i < len; i++) {
            jobject twoObj = env->GetObjectArrayElement(twoArray, i);
            pt.startdate = env->GetIntField(twoObj, startdateID);
    pt[i].enddate = env->GetIntField(twoObj, enddateID);
    // return the resulting 'two' C++ struct array
    return pt;
    Regards

  • How to invoke updateDisplayList method in the custom layout?

    I've a group of buttons that get placed in a SkinnableDataContainer with the help of a custom layout class as follows:
    <s:SkinnableDataContainer id="buttonsContainer"
        dataProvider="{appModel.myButtons}"
        width="{DIAPLAY_WIDTH}" height="{BUTTON_HEIGHT+4}"
        skinClass="view.skins.ContainerSkin"
        itemRenderer="view.renderer.MyButtonRenderer"
        click="startPointAreaClickHandler(event)"
        mouseMove="areaMouseMoveHandler(event)"
        mouseUp="areaMouseUpHandler(event)"
        rollOut="areaMouseOutHandler(event)"
        >
        <s:layout>
            <layout:ButtonsLayout />
        </s:layout>
    </s:SkinnableDataContainer>
    myButtons is an ArrayCollection of VOs and VO has x and y coordinates as fields. Values of x and y determine the location of the button. When I add an object to myButtons, the application behaves as expected (adds a button in buttonsContainer at specified x and y coordinate). But when I just change values of x and y of an existing button, the buttons don't get repositioned. I have tried calling invalidateDisplayList on buttonsContainer but that doesn't trigger updateDisplayList method in the custom layout ButtonsLayout.
    How do I trigger updateDisplayList method in the custom layout so that the button positions get updated whenever an event changes values of x and y of a button?

    Hi Balus,
    This is helpful but one problem i faced with this is, when i overided the custom message in the property file,
    javax.faces.component.UIInput.REQUIRED =Value is required
    but for every UIInput component the same message is coming, but if i am having more than one component on the page forexample: UserName , Email, Password etc...
    i need to display messages like
    Value is reuired for UserName
    Value is reuired for Password
    Value is reuired for Email
    How this is possible , can u please help me.
    Thank You,
    Subrahmanyam Baratam.

  • How to invoke a method in TF Template

    Hi All,
    Is there any way to execute a method in Taskflow template before executing the extended TF.
    I have two Bounded TF which are based on a Bounded TF Template, I want to execute the method in Template before executing my TF.
    Let me know if there is a way.
    Regards,
    Suresh

    there is a initializer and finalizer.. you can make use of it..
    chk
    Method Call on Taskflow Initializer

Maybe you are looking for

  • How do I find the SID of an Oracle 8.0 install ?

    I have a Win NT that acts as the Domain in our LAN + 3 Win 98 boxes , that need to get to the Oracle database situated on the Win NT machine. I tried creating the service using Net8 Assistant on the Win98 machine from which I type this, then I notice

  • Trying to get a WRT54GX2 wireless router working with a W...

    Trying to get a WRT54GX2 wireless router working with a WPC54G wireless card. The laptop and desktop both will access the Internet and work when hardwired through the router's Ethernet ports. When trying to access wireless, the Laptop shows to be con

  • Serial number not working any suggestions

         My computer died on me last January and I had to reinstall everything and after reinstalling lightroom 2 it would not accept the serial number that I had . I called adobe and after giving me several new serial numbers ( none that would work ) th

  • Does anyone 'not' have an afflicted superdrive?

    Everyone is talking about how the superdrives don't work, but is there anyone out there who has read this that does have one that works? Just thought it would help us all out, getting a perspective on how many work... Thanks!

  • Cant drag and drop audio files from my pc

    Recently had a missing dll issue which forced me to remove and re-install itunes and now  I can't drag and drop from my PC.