How to get af:commandbutton id in java code when it is triggered?

Hi All
In my application's homepage, I am using 2 af:commandbuttons and each using action attribute to call a method. Both are calling the same method, and based on its id, it should perform different operations. Could anyone please tell me how to get command buttons id in java code, when it is triggered.
Regards
Venkat

Venkat,
why not call different methods from each button?
public String actionButton1()
return doAction("button1");
public String actionButton2()
return doAction("button2");
public String doAction(String aBuuton)
if ("button1".equalsIgnoreCase(aButton))
// do work for button 1
return "abc";
}else {
// do work for button 2
return "abc";
}Now you user actionbutton1 for the first button and actionButton2 for the second.
Or you directly implement two different methods in the bean and call each one directly from the button.
Timo

Similar Messages

  • How to get job id in my java code?

    I know that using showjobs command can get the list of jobs and their id.But I want give to control the users to access the reports.This means the different users can only stop the report which I give them permission.How can I solve this problem?If has any suggestion,please answer me of mail to ma.thank a lot.

    What would you do with the pid? the actual pid is OS dependent in form and how to react. You could do what I've done in the past and that is to do the following.
    I have a java task that spawns new instances of 'things'. As each thing is 'exec'ed, I place its Process object into a 'running queue' and then periodically check its exitValue() to determine if it is still running or not.
    if you don't care about OS dependency and happen to be on a unix system, then when you exec the process, add a unique string as a command line argument that you know won't be used. something like this:
    mypgm -a=blah -b=blah2 myUniqueString
    Then in your code that retrieves the process id, simply do something like this:
    ps -efwww | grep myUniqueString | awk ....
    awk it into something usable or perhaps just grab the raw and parse it in java to extract the process id.
    I think the danger would reside in the idea that if you were to grab the processid and then do a 'kill -9 xx' that java might not clean up correctly. What would happen if a db transaction was taking place right as the -9 signal was received? The results of course would be OS dependent.
    Why do you need the process id? thats the real question....

  • How to get value in HKEY_LOCAL_MACHINE in Java code

    Our system use Apache-Tomcat. My java program needs to get the registry information (server name, port number,...) in HKEY_LOCAL_MACHINE on the same computer. Could it be done without JNI? Please forward instruction.
    Thanks.

    here is an API
    http://downloads.openchannelsoftware.com/JIFI/jifidoc/javax/jifi/service/win32registry/Registry.html
    try downloading it at http://www.openchannelsoftware.com/

  • How to get the context data using java script in interactive forms

    Hi All,
    How to get the context data using java script in interactive forms by adobe,  am using web dynpro java
    thanks.

    Hi venkat,
    Please Refer this link.
      Populating one Drop-Down list from the selection of another Drop-down list
    Thanks,
    Raju.

  • Keep getting a prompt to install java even when not surfing the net. I have java installed and the control panel says it is right version. Want to know how to stop prompts. This started after I installed Yosemite.

    Since installing Yosemite I keep getting a prompt to install Java even when I am not surfing the net. Went system preferences and I have recommended version installed. I want to know how to stop the prompts. I do not have this problem on my iMac.

    Most likely, you have either the Facebook video calling plugin or the "NexDef" plugin for watching baseball streams. Both depend on the Java runtime distributed by Apple. If you no longer need the plugin, remove it. Otherwise, install Java.

  • How to call a .bat file from java code?

    How to call a .bat file from java code? and how can i pass parameters to that .bat file?
    Thanks in advance

    thanks for ur reply
    but still i am getting the same error.
    I am trying to run a .bat file of together tool, my code looks like below
    import java.lang.Runtime;
    import java.lang.Process;
    import java.io.File;
    class SysCall{
         public static void main(String args[]){
              String cmd="D://Borland//Together6.2//bin//Together.bat -script:com.togethersoft.modules.qa.QA -metrics out:D://MySamples//Metrics// -fmt:html D://Borland//Together6.2//samples//java//CashSales//CashSales.tpr";
              //String path="D://Borland//Together6.2//bin//Together.bat ";
              Runtime r= Runtime.getRuntime(); //Declare the system call
              try{
                   System.out.println("Before batch is called");
                   Process p=r.exec(cmd);
                   System.out.println(" Exit value =" + p.exitValue());
                   System.out.println("After batch is called");
              /*can produce errors which must be caught*/
              catch(Exception e) {
                   e.printStackTrace();
                   System.out.println (e.toString());
    I am getting the below exception
    Before batch is called
    java.lang.IllegalThreadStateException: process has not exited
    at java.lang.Win32Process.exitValue(Native Method)
    at SysCall.main(SysCall.java:17)
    java.lang.IllegalThreadStateException: process has not exited

  • How to get access to my iCloud back up when setting up a new iPhone 5s which needs the newest version of iOS7 first?

    how to get access to my iCloud back up when setting up a new iPhone 5s which needs the newest version of iOS7 first?

    Set up the new phone as a new iPhone (without using your backup), then update it to the latest iOS (7.1.2).  Then go to Settings>General>Reset, tap Erase All Content and Settings, go through the setup screens again and when given the option, choose Restore from iCloud Backup and follow the prompts.  This process is explained in more detail here: iCloud: Restore your iOS device from iCloud.

  • How to use .properties files in Webdynpro Java code?

    Hi all,
      I want to use a logon.properties file when I initial a JCO connection pool in my webdynpro DC (JCO.addClientPool()),but  I found when I deployed this DC to the server, it always giv e me an FileNotFoundException. So I donot know how to deploy a .properties file to the server and how to access this file in my Java code?
    Thans and Best regards
    Deyang

    Hi,
    1) put .properties file to your packege under src\packages folder (src\packages\com\sdn\properties\jco.properties)
    2) load property:
         final InputStream is = getClass().getClassLoader().getResourceAsStream("com/sdn/properties/jco.properties");
         final Properties properties = new Properties();
         try
              properties.load(is);
         catch(Exception e)
              wdComponentAPI.getMessageManager().reportException(new WDNonFatalException(e), false);
    Regatds Maxim R.

  • How to get rid of /j2ee prefix from URL when I use the OC4J via Oracle HTTP server

    In 9iAS 9.0.2 Oracle HTTP Server (OHS) is pre-configured to assign requests to the Home OC4J instance via the URL-prefix "/j2ee"/
    For example, the TEST servlet under OC4J would be passed through OHS using:
    http://urmachine:urApachePort/j2ee/TEST
    whereas in the standlone OC4J version, this URL works:
    http://urmachine:urOC4JPort/TEST
    How to get rid of /j2ee prefix from URL when I use the OC4J via Oracle HTTP Server?

    It is getting the url prefix from mod_oc4j.conf
    under /ora9ias/Apache/Apache/conf
    You can read more on this at
    http://otn.oracle.com/docs/products/ias/doc_library/90200doc_otn/web.902/a92173/confmods.htm#1008977
    -Prasad

  • How to create a oracle database by java code?

    how to create a oracle database by java code?
    please give some ways then that way's code

    I'm not sure what you mean with "database". Do you mean an Oracle instance or an Oracle user/schema (probably the latter, because that's the equivalent to a MS SQL Database).
    Creating an instance is definitely not possible from within Java. To create a new user this should be possible, as this can be done with SQL:
    GRANT connect,resource TO <newuser> IDENTIFIED BY <password>;
    I'm always cautious with questions like this. In 90% of the cases there is something wrong with the initial design. Creating a database shouldn't be something the application is doing.
    Thomas

  • How to call web-service using only java code

    Hello, how to call web-service using only java code. I can call it from BPM process or Web Dynpro Java Application, but if I need to call it from ejb component?

    I'm found answer:
    Java and SAP Portal blog: How to call web service from java code example

  • How to read XI Data type in Java code and populate as array list, using UDF

    Hi,
    How to read XI Data type in Java code and populate as array list, using UDF?
    Is there any API using which  the XI data types can be read?
    Kindly reply.
    Richa

    Input Structure:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:CustomerCreateResp xmlns:ns0="urn:bp:xi:up:re:cust_mdm:cmdm:pr5:100">
       <CUSTOMER>
          <item>
             <CUSTOMERNO/>
             <MDMCUSTOMER/>
             <CREATE_DATE/>
             <RETURN>
                <TYPE/>
                <MESSAGE/>
             </RETURN>
             <PT_CONTPART_RETURN>
                <item>
                   <MDM_CONTACT/>
                   <CONTACT/>
                </item>
             </PT_CONTPART_RETURN>
             <PARTNERS>
                <item>
                   <CUSTOMERNO/>
                   <PARTNER_FUNCTION/>
                   <PARTNER_NUMBER/>
                   <DEFAULT_PARTNER/>
                </item>
             </PARTNERS>
          </item>
       </CUSTOMER>
    </ns0:CustomerCreateResp>
    Output structure
    (Sample output structure.This actually needs to be mapped and generated using UDF)
    <?xml version="1.0" encoding="UTF-8"?>
    <ns1:updateCustomer xmlns:ns1="urn:xiSericeVi"><ns1:customer><ns2:ArrayList xmlns:ns2="java:sap/standard">[]</ns2:ArrayList></ns1:customer><ns1:name>2344566</ns1:name></ns1:updateCustomer>

  • How to find the  System Dbtype in java code

    How to find the System Dbtype in java code
    I need various Db connection my project (oracle, sq l,sybase,db2),So How to find the System Dbtype in java code

    Welcome to the Forums.
    Please go through the FAQ of the Forum.
    You has posted your query in the wrong Forum, this one is dedicated to Oracle Forms.
    Please try {forum:id=1050}.
    Regards,

  • HT204291 how do get the media icon for mac mirroring when running airplay on itunes?

    how do get the media icon for mac mirroring when running airplay

    Airplay mirroring requires a Mac from 2011 or later, running OSX 10.8 (or later)
    http://support.apple.com/kb/HT5404?viewlocale=en_US&locale=en_US

  • How do get rid of the google search box when I first open Firefox?

    How do get rid of the google search box when I first open Firefox?

    Firefox 4 and later versions use a new build-in home page named <b>about:home</b> with a Google search bar on it.
    That about:home page only shows some snippets and has a button to restore the previous session if applicable.
    If you want a home page with extras then set another page as the home page like www.google.com as used in Firefox 3 versions.
    *https://support.mozilla.com/kb/How+to+set+the+home+page
    See also:
    *Tools > Options > General > Startup: "When Firefox Starts": "Show my home page" "Show a blank page"

Maybe you are looking for

  • Best way to give a default value to a New Column with existing rows

    Adding some columns to SQL tables with existing data rows. There are also views created from these tables. The views are used in some report/query software so NULL values are not good. Interested in learning about the best way to set a default value.

  • Boot Camp, Aluminium Bluetooth Keyboard & Mighty Mouse not seen by Windows

    I recently installed bootcamp (win xp pro sp2), and am unable to get windows to recognise my bluetooth keyboard and mouse. they work fine in OSX, and i know that the bluetooth drivers are good in windows because i can connect to my phone. I think the

  • Import: CVD Base Value field is blank in MIGO

    All SAP gurus, We are running a Import's scenario. For this we have created Z condition types for CVD and BCD,  maintained all the condition types in pricing procedure (Customs Duty and CVD etc) Excise defauls are also maintained. problem we are faci

  • Cannot copy from vim in PuTTY

    Hi, I'm not sure if this is the right place to post this question, but here I go anyway... In PuTTY I'm able to copy text just by selecting it. This works everywhere except for inside Vim. In Vim, when I select text, it automatically sets Visual mode

  • Wireless stopped working

    Brother's support said the issue must be with the computer - I've entered all the wireless info into my Brother multifunction machine but it keeps saying to Check Connection. Anyone have any ideas? I had it running wirelessly but learned the hard way