How to call a static method in a class if I have just the object?

Hello. I have an abstract class A where I have a static method blah(). I have 2 classes that extend class A called B and C. In both classes I override method blah(). I have an array with objects of type B and C.
For every instance object of the array, I'm trying to call the static method in the corresponding class. For objects of type B I want to call blah() method in B class and for objects of type C I want to call blah() method in C class. I know it's possible to call a static method with the name of the object, too, but for some reason (?) it calls blah() method in class A if I try this.
So my question is: how do I code this? I guess I need to cast to the class name and then call the method with the class name, but I couldn't do it. I tried to use getClass() method to get the class name and it works, but I didn't know what to do from here...
So any help would be appreciated. Thank you.

As somebody already said, to get the behavior you
want, make the methods non-static.You all asked me why I need that method to be
static... I'm not surprised to hear this question
because I asked all my friends before posting here,
and all of them asked me this... It's because some
complicated reasons, I doubt it.
the application I'm writing is
quite big...Irrelevant.
Umm... So what you're saying is there is no way to do
this with that method being static? The behavior you describe cannot be obtained with only static methods in Java. You'd have to explicitly determine the class and then explicitly call the correct class' method.

Similar Messages

  • How to call a static method of a class (continued)

    In reference to the above topic posted one week ago I give you the relative code. The problem is resolved and it was the following one (amazing for me since I looked for any possible error in the code like the one posted in my article but I could never imagine this trivial thing.........):
    the package name which is the directory with the appropriate class files should not extend the lenght of 8 characters!!! Initially I had a package named Applications (too long for DOS...) and when I renamed it to Test everything worked. Any suggestion on how to overcome this DOS filesystem problem?
    Christos
    Here is my simplified code
         package test;
         import java.io.*;
         import java.net.URL;
         import javax.swing.*;
         import java.beans.*;
         import java.awt.*;
         import java.awt.event.*;
         public class myapplet extends JApplet
         private MyClass myframe;
         private JDesktopPane desktop;
         private Dimension d;
    public void init() {
    myframe= new MyClass();
    desktop = new JDesktopPane();
    d=desktop.getSize();
    try {
    javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
    public void run() {
    createGUI();
    } catch (Exception e) {
    System.err.println("createGUI didn't successfully complete");
         private void createGUI() {
         myframe.pack();
         myframe.setBounds(0,0,d.width,d.height);
         desktop.add(myframe);
         this.getContentPane().add(desktop);
         try {
         myframe.setMaximum(true);
         } catch (PropertyVetoException e) {
         e.printStackTrace();
         myframe.setVisible(true);
    protected static ImageIcon createAppletImageIcon(String path,
    String description)
    int MAX_IMAGE_SIZE = 75000; //Change this to the size of
    //your biggest image, in bytes.
    int count = 0;
    BufferedInputStream imgStream = new BufferedInputStream(
    myapplet.class.getResourceAsStream(path));
    if (imgStream != null)
    byte buf[] = new byte[MAX_IMAGE_SIZE];
    try {
    count = imgStream.read(buf);
    } catch (IOException ieo) {
    System.err.println("Couldn't read stream from file: " + path);
    try {
    imgStream.close();
    } catch (IOException ieo) {
    System.err.println("Can't close file " + path);
    if (count <= 0) {
    System.err.println("Empty file: " + path);
    return null;
    return new ImageIcon(Toolkit.getDefaultToolkit().createImage(buf),
    description);
    } else {
    System.err.println("Couldn't find file: " + path);
    return null;
    followed by the class MyClass
    package test;
         import javax.swing.*;
         import java.awt.*;
         import java.awt.event.*;
         public class MyClass extends JInternalFrame
         private JLabel jl;
         private String myicon1="images/myimage.gif";
         private ImageIcon image1;
         public MyClass()
         super ( "This is my application",false,true,true,false);
         setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    image1= myapplet.createAppletImageIcon(myicon1,"");
    jl = new JLabel("This is my image",
              image1,JLabel.CENTER);
    jl.setFont (new Font("Times-Roman",Font.BOLD, 17));
    getContentPane().add(jl);
    and finally the html file with the applet tag:
    <APPLET CODE = "test.myapplet" width=760 height=380>
    </APPLET>

    I have to say that everything works fine even with
    long package names besides the loading of the image in
    MyClass (in fact you see the JInternalFrame with the
    JLabel without icon!). Since I never saw an error in
    the Sun Java Console or the DOS window I tried this
    last solution, i.e. to shorten the package name. Only
    then the icon appears in the label......strange thingsThere shouldn't be a problem with long package (and hence long directory) names.
    private String myicon1="images/myimage.gif"; // which becomes the 'path' variable below
    BufferedInputStream imgStream = new BufferedInputStream(
    myapplet.class.getResourceAsStream(path));So are you sure you are always putting this images subdirectory underneath where your myapplet class lives? If myapplet.class lives in /foo/bar/mypackage, belongs to the 'mypackage' package, and your classpath includes /foo/bar, then your gif file better be at /foo/bar/mypackage/images/myimage.gif (or actually at mypackage/images/myimage.gif from any classpath root)

  • How to call a static method of a class from another class?

    Hello,
    I have two classes in a package. The first one
    package my package;
    public class class1
    protected static ImageIcon createIcon(String path)
    The second one
    package my package;
    public class class2
    private ImageIcon image1;
    image1 = class1.createIcon("/mypath");
    This does not work since class2 cannot load the appropriate image. Where do I have to define the ImageIcon variables in class one or two and do they have to be static variables?
    Thanks in advance
    Christos

    If the two classes are in the same package, that will work, in fact. A trivial example:
    package foo;
    public class Foo1 {
         protected static String getString() {
              return "World";
    // Note: Member of the same package
    package foo;
    public class Foo2 {
         public static void main(String[] argv) {
              System.out.println("Hello "+ foo.Foo1.getString());
    }However, if they are in different packages that won't work - the protected keyword guarantees that only classes derived from the class with the protected method can access it: Therefore this will not work:
    package foo;
    public class Foo1 {
         protected static String getString() {
              return "World";
    package foo.bar;
    public class Foo2{
         public static void main(String[] argv) {
              System.out.println("Hello "+ foo.Foo1.getString());
    }But this will:
    package foo;
    public class Foo1 {
         protected static String getString() {
              return "World";
    package foo.bar;
    public class Foo2 extends foo.Foo1 {
         public static void main(String[] argv) {
              System.out.println("Hello "+ foo.Foo1.getString());
    }I think you should read up a bit more about packages and inheritance, because you're going to have a lot of trouble without a good understanding of both. Try simple examples first, like the above, and if you hit problems try to produce a simple test case to help you understand the problem rather than trying to debug your whole application.
    Dave.

  • How to call a static method from an event handler

    Hi,
       I'm trying to call a static method of class I designed.  But I don't know how to do it.  This method will be called from an event handler of a web dynpro for Abap application.
    Can somebody help me?
    Thx in advance.
    Hamza.

    To clearly specify the problem.
    I have a big part code that I use many times in my applications. So I decided to put it in a static method to reuse the code.  but my method calls functions module of HR module.  but just after the declaration ( at the first line of the call function) it thows an exception.  So I can't call my method.

  • Calling a static method from another class

    public class Command
        public static void sortCommands(String command, String order, List object)
             if(command.equalsIgnoreCase("merge") && order == "a")
                  object.setAscending(true);
                  Mergesort.mergesort(object.list);                  // line 85
    }and
    public class Mergesort
         public static void mergesort (int[] a)
              mergesort(a, 0, a.length-1);
         private static void mergesort (int[] a, int l, int r)
         private static void merge (int[] a, int l, int m, int r)
    }Error:
    Command.java:85: cannot find symbol
    symbol : variable Mergesort
    location: class Command
    Mergesort.mergesort(object.list)
    What am I doing wrong here? Within the Command class I am calling mergesort(), a static method, from a static method. I use the dot operator + object so that the compiler would recognize the 'list' array. I tried using the
    Mergesort.mergesort(object.list);notation in hopes that it would work like this:
    Class.staticMethod(parameters);but either I am mistaken, misunderstood the documentation or both. Mergesort is not a variable. Any help would be appreciated, I have been hitting a brick wall for hours with Java documentation. Thanks all.

    [Javapedia: Classpath|http://wiki.java.net/bin/view/Javapedia/ClassPath]
    [How Classes are Found|http://java.sun.com/j2se/1.5.0/docs/tooldocs/findingclasses.html]
    [Setting the class path (Windows)|http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/classpath.html]
    [Setting the class path (Solaris/Linux)|http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/classpath.html]
    [Understanding the Java ClassLoader|http://www-106.ibm.com/developerworks/edu/j-dw-javaclass-i.html]
    java -cp .;<any other directories or jars> YourClassNameYou get a NoClassDefFoundError message because the JVM (Java Virtual Machine) can't find your class. The way to remedy this is to ensure that your class is included in the classpath. The example assumes that you are in the same directory as the class you're trying to run.
    javac -classpath .;<any additional jar files or directories> YourClassName.javaYou get a "cannot resolve symbol" message because the compiler can't find your class. The way to remedy this is to ensure that your class is included in the classpath. The example assumes that you are in the same directory as the class you're trying to run.

  • How to call a java method so I can pass a file into the method

    I want to pass a file into a java method method from the main method. Can anyone give me some help as to how I pass the file into the method - do I pass the file name ? are there any special points I need to put in the methods signature etc ?
    FileReader file = new FileReader("Scores");
    BufferedReader infile = new BufferedReader(file);
    Where am I supposed to put the above text - in the main method or the one I want to pass the file into to?
    Thanks

    It's a matter of personal preference really. I would encapsulate all of the file-parsing logic in a separate class that implements an interface so that if in the future you want to start taking the integers from another source, e.g. a db, you wouldn't need to drastically alter your main application code. Probably something like this, (with an assumption that the numbers are delimited by a comma and a realisation that my file-handling routine sucks):
    public class MyApp{
    public static void main(String[] args){
    IntegerGather g = new FileIntegerGatherer();
    Integer[] result = g.getIntegers(args[0]);
    public interface IntegerGatherer{
    public Integer[] getIntegers(String location);
    import java.io.*;
    public class FileIntegerGatherer implements IntegerGatherer{
    public Integer[] getIntegers(String location){
    FileInputStream fs=null;
    try{
    File f = new File(location);
    fs = new FileInputStream(f);
    byte[] in = new byte[1024];
    StringBuffer sb = new StringBuffer();
    while((fs.read(in))!=-1){
    sb.append(new String(in));
    StringTokenizer st = new StringTokenizer(sb.toString(),",");
    Integer[] result = new Integer[st.countTokens()];
    int count = 0;
    while(st.hasMoreTokens()){
    result[count]=Integer.valueOf(st.nextToken());
    count++;
    catch(IOException e){
    //something sensible here
    finally{
    if(fs!=null){
    try{
    fs.close();
    catch(IOException f){
    return result;
    Once compiled you could invoke it as java MyApp c:\myInts.txt
    Sorry if there are typos in there, I don't have an ide open ;->

  • How to Call Event Handler Method in Another view

    Hi Experts,
                       Can anybody tell me how to call Event handler Method which is declared in View A ,it Should be Called in
      view B,Thanks in Advance.
    Thanks & Regards
    Santhosh

    hi,
    1)    You can make the method EH_ONSELECT as public and static and call this method in viewGS_CM/ADDDOC  using syntax
        impl class name of view GS_CM/DOCTREE=>EH_ONSELECT "method name.
                 or
    2)The view GS_CM/ADDDOC which contains EH_ONSELECT method has been already enhanced, so I can't execute such kind of operation one more time.
                         or
    3)If both views or viewarea containing that view are under same window , then you can get the instance ofGS_CM/DOCTREE from view GS_CM/ADDDOC  through the main window controller.
    lr_window = me->view_manager->get_window_controller( ).
        lv_viewname = 'GS_CM/DOCTREE '.
      lr_viewctrl ?=  lr_window ->get_subcontroller_by_viewname( lv_viewname ).
    Now you can access the method of view GS_CM/DOCTREE .
    Let me know in case you face any issues.
    Message was edited by: Laure Cetin
    Please do not ask for points, this is against the Rules of Engagement: http://scn.sap.com/docs/DOC-18590

  • Call a static method via RFC

    Hello people,
    How can I call a static method via RFC?
    I am in SRM and would like to call a static method defined in ECC.
    What is necessary to be configured in this class/method?
    Thanks!!!

    You may need to write RFC in ECC and call it from SRM
    and write following code in RFC for call a static method
    reference_obj=>method_name
    EXPORTING

  • How to execute a static method twice

    Hi all,
    In the attached code, as you can see I call the method at.sendRequestString(), twice from main() method.
    The first line in sendRequestString() method is Authenticator.setDefault(new MyAuthenticator());
    Authenticator is an abstract class and setDefault is a static method in that class.
    When I call sendRequestString() for the second time, Authenticator.setDefault(new MyAuthenticator()); is not executed. ie; Authenticator.setDefault gets executed once and only once.
    Does this happen because that Authenticator.setDefault is a static method and it will be executed only once?
    If yes, how can I make it work for the second time?
    Here is my simple Java code. The username and password given in the code are just sample ones.
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.net.Authenticator;
    import java.net.MalformedURLException;
    import java.net.PasswordAuthentication;
    import java.net.URL;
    public class GetAuthenticatedData
         public String address;
         static String username;
         static String password;
         public GetAuthenticatedData(String address){
              this.address = address;
         public String sendRequestString()
              Authenticator.setDefault(new MyAuthenticator());//BEING STATIC METHOD, SET DEFAULT CALLED ONLY ONCE
             String str = null;
             try {
                 URL url = new URL(address);
                 BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
                 while (( str = in.readLine()) != null) {
                      return str;
                 in.close();
             } catch (MalformedURLException e) {
                  System.out.println("e1"+e);
             } catch (IOException e) {
                  System.out.println("e2"+e);
             Authenticator.setDefault(null);
              return str;
         public static void main(String args[]){
              username = "username1";
              password = "password1";
              GetAuthenticatedData at = new GetAuthenticatedData("https://" + username +":"+ password + "@www.mybooo.com/core/Dd002wW.php?data={action:'contacts',args:''}");
              System.out.println("value corresponding to username1 and password1"+at.sendRequestString());
              username = "username2";
              password = "password2";
              at = new GetAuthenticatedData("https://" + username +":"+ password + "@www.mybooo.com/core/Dd002wW.php?data={action:'contacts',args:''}");
              System.out.println("value corresponding to username2 and password2 "+at.sendRequestString());
    class MyAuthenticator extends Authenticator {
         public MyAuthenticator(){
              getPasswordAuthentication();
              protected PasswordAuthentication getPasswordAuthentication() {
                   PasswordAuthentication auth = new PasswordAuthentication(GetAuthenticatedData.username, GetAuthenticatedData.password.toCharArray());
                 System.out.println("Username"+auth.getUserName());
                 System.out.println("Password"+new String(auth.getPassword()));
                   return auth;
    }Please help with an appropriate solution.
    Any help in this regard will be well appreciated with dukes.
    Anees

    Thanks for your valuable help Looce. But it still does not solve the problem.
    Here is how I used your code.
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.net.Authenticator;
    import java.net.MalformedURLException;
    import java.net.PasswordAuthentication;
    import java.net.URL;
    public class GetAuthenticatedData
         public String address;
         static String username;
         static String password;
         public GetAuthenticatedData(String address){
              this.address = address;
         MyAuthenticator authenticator = new MyAuthenticator("username1","password1".toCharArray());
         public String sendRequestString(String user, String pass)
              authenticator.setUsername(user);
              authenticator.setPassword(pass.toCharArray());
              Authenticator.setDefault(authenticator);
             String str = null;
             try {
                 URL url = new URL(address);
                 BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
                 while (( str = in.readLine()) != null) {
                      return str;
                 in.close();
             } catch (MalformedURLException e) {
                  System.out.println("e1"+e);
             } catch (IOException e) {
                  System.out.println("e2"+e);
             Authenticator.setDefault(null);
              return str;
         public static void main(String args[]){
              username = "username1";
              password = "password1";
              GetAuthenticatedData at = new GetAuthenticatedData("https://" + username +":"+ password + "@www.mybooo.com/core/Dd002wW.php?data={action:'contacts',args:''}");
              System.out.println("value corresponding to username1 and password1"+at.sendRequestString("username1","password1"));
              username = "username2";
              password = "password2";
              at = new GetAuthenticatedData("https://" + username +":"+ password + "@www.mybooo.com/core/Dd002wW.php?data={action:'contacts',args:''}");
              System.out.println("value corresponding to username2 and password2 "+at.sendRequestString("password2","password2"));
    * This class implements an Authenticator whose username and password information can
    * change over time.
    * @author Cynthia G., Sun Java forums: http://forums.sun.com/thread.jspa?messageID=10504183
    class MyAuthenticator extends java.net.Authenticator {
      /** Stored user name. */
      private String username;
      /** Stored password. */
      private char[] password;
      /** Constructs an instance of MyAuthenticator with the given initial user name
       * and password. These may be modified with the setUsername and setPassword
       * methods.
      public MyAuthenticator(String username, char[] password) {
        this.username = username;
        this.password = password;
      public void setUsername(String username) { this.username = username; }
      public void setPassword(char[] password) { this.password = password; }
      protected java.net.PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password); }
    }

  • How to call a bean method from javascript event

    Hi,
    I could not find material on how to call a bean method from javascript, any help would be appreciated.
    Ralph

    Hi,
    Basically, I would like to call a method that I have written in the page java bean, or in the session bean, or application bean, or an external bean, from the javascript events (mouseover, on click, etc...) of a ui jsf component. I.e., I would like to take an action when a user clicks in a column in a datatable.
    Cheers,
    Ralph

  • How to call a AM method with parameters from Managed Bean?

    Hi Everyone,
    I have a situation where I need to call AM method (setDefaultSubInv) from Managed bean, under Value change Listner method. Here is what I am doing, I have added AM method on to the page bindings, then in bean calling this
    Class[] paramTypes = { };
    Object[] params = { } ;
    invokeEL("#{bindings.setDefaultSubInv.execute}", paramTypes, params);
    This works and able to call this method if there are no parameters. Say I have to pass a parameter to AM method setDefaultSubInv(String a), i tried calling this from the bean but throws an error
    String aVal = "test";
    Class[] paramTypes = {String.class };
    Object[] params = {aVal } ;
    invokeEL("#{bindings.setDefaultSubInv.execute}", paramTypes, params);
    I am not sure this is the right way to call the method with parameters. Can anyone tell how to call a AM method with parameters from Manage bean
    Thanks,
    San.

    Simply do the following
    1- Make your Method in Client Interface.
    2- Add it to Page Def.
    3- Customize your Script Like the below one to Achieve your goal.
    BindingContainer bindings = getBindings();
    OperationBinding operationBinding = bindings.getOperationBinding("GetUserRoles");
    operationBinding.getParamsMap().put("username", "oracle");
    operationBinding.getParamsMap().put("role", "F1211");
    operationBinding.getParamsMap().put("Connection", "JDBC");
    Object result = operationBinding.execute();
    if (!operationBinding.getErrors().isEmpty()) {
    return null;
    return null;
    i hope it help you
    thanks

  • Calling a non-static method from another Class

    Hello forum experts:
    Please excuse me for my poor Java vocabulary. I am a newbie and requesting for help. So please bear with me! I am listing below the program flow to enable the experts understand the problem and guide me towards a solution.
    1. ClassA instantiates ClassB to create an object instance, say ObjB1 that
        populates a JTable.
    2. User selects a row in the table and then clicks a button on the icon toolbar
        which is part of UIMenu class.
    3. This user action is to invoke a method UpdateDatabase() of object ObjB1. Now I want to call this method from UIMenu class.
    (a). I could create a new instance ObjB2 of ClassB and call UpdateDatabase(),
                                      == OR ==
    (b). I could declare UpdateDatabase() as static and call this method without
         creating a new instance of ClassB.With option (a), I will be looking at two different object instances.The UpdateDatabase() method manipulates
    object specific data.
    With option (b), if I declare the method as static, the variables used in the method would also have to be static.
    The variables, in which case, would not be object specific.
    Is there a way or technique in Java that will allow me to reference the UpdateDatabase() method of the existing
    object ObjB1 without requiring me to use static variables? In other words, call non-static methods in a static
    way?
    Any ideas or thoughts will be of tremendous help. Thanks in advance.

    Hello Forum:
    Danny_From_Tower, Encephalatic: Thank you both for your responses.
    Here is what I have done so far. I have a button called "btnAccept" created in the class MyMenu.
    and declared as public.
    public class MyMenu {
        public JButton btnAccept;
         //Constructor
         public MyMenu()     {
              btnAccept = new JButton("Accept");
    }     I instantiate an object for MyMenu class in the main application class MyApp.
    public class MyApp {
         private     MyMenu menu;
         //Constructor     
         public MyApp(){
              menu = new MyMenu();     
         public void openOrder(){
               MyGUI MyIntFrame = new MyGUI(menu.btnAccept);          
    }I pass this button all the way down to the class detail02. Now I want to set up a listener for this
    button in the class detail02. I am not able to do this.
    public class MyGUI {
         private JButton acceptButton;
         private detail02 dtl1 = new detail02(acceptButton);
         //Constructor
         public AppGUI(JButton iButton){
         acceptButton = iButton;
    public class detail02{
        private JButton acceptButton;
        //Constructor
        public detail02(JButton iButton){
          acceptButton = iButton;
          acceptButton.addActionListener(new acceptListener());               
       //method
        private void acceptListener_actionPerformed(ActionEvent e){
           System.out.println("Menu item [" + e.getActionCommand(  ) + "] was pressed.");
        class acceptListener implements ActionListener {       
            public void actionPerformed(ActionEvent e) {
                   acceptListener_actionPerformed(e);
    }  I am not able to get the button Listener to work. I get NullPointerException at this line
              acceptButton.addActionListener(new acceptListener());in the class detail02.
    Is this the right way? Or is there a better way of accomplishing my objective?
    Please help. Your inputs are precious! Thank you very much for your time!

  • How to call standard SAP method in the Custom Program ?

    Hi,
    i need to call sap standard method 'OpenItemRollinout' in my custom program. For the SAP Standard method 'OpenItemRollinoun' the BOR(Business Object) is 'PAYSCHEME'. So how to call the SAP standard method in the custom program ???

    Hi,
    In the method that you have provided only one function module is being used so better use the FM and copy the remaining code based on ur requirement.
    FM is ISU_S_PAYSCHEME_ROLLIN_ROLLOUT.
    Regards,
    Vijay.

  • Can we call a static method without mentioning the class name

    public class Stuff {
         public static final int MY_CONSTANT = 5;
         public static int doStuff(int x){ return (x++)*x;}
    import xcom.Stuff.*;
    import java.lang.System.out;
    class User {
       public static void main(String[] args){
       new User().go();
       void go(){out.println(doStuff(MY_CONSTANT));}
    }Will the above code compile?
    can be call a static method without mentioning the class name?

    Yes, why do it simply?
    pksingh79 wrote:
    call a static method without mentioning the class name?For a given value of   "without mentioning the class name".
        public static Object invokeStaticMethod(String className, String methodName, Object[] args) throws Exception {
            Class<?>[] types = new Class<?>[args.length];
            for(int i=0;i<args.length;++i) types[i] = args==null?Object.class:args[i].getClass();
    return Class.forName(className).getDeclaredMethod(methodName,types).invoke(null,args);

  • How to call jpf controller method from javascript

    Can any one help me how to call pageflow controller method from JavaScript.\
    Thanks.

    Accessing a particular pageflow method from Javascript is directly not possible unless we do some real funky coding in specifying document.myForm.action = xyz...Heres what I tried and it did not work as expected: I found another workaround that I will share with you.
    1. In my jsp file when I click a button a call a JavaScript that calls the method that I want in pageflow like this: My method got invoked BUT when that method forwards the jsp, it lost the portal context. I saw my returned jsp only on the browser instead of seeing it inside the portlet on the page of a portal. I just see contents of jsp on full browser screen. I checked the url. This does make the sense. I do not see the url where I will have like test1.portal?_pageLabe=xxx&portlet details etc etc. So this bottom approach will notwork.
    document.getElementById("batchForm").action = "/portlets/com/hid/iod/Batches/holdBatch"; // here if you give like test1.portal/pagelable value like complete url...it may work...but not suggested/recommended....
    document.getElementById("batchForm").submit;
    2. I achieved my requirement using a hidden variable inside my netui:form tag in the jsp. Say for example, I have 3 buttons and all of them should call their own action methods like create, update, delete on pageflow side. But I want these to be called through javascript say for example to do some validation. (I have diff usecase though). So I created a hidden field like ACTION_NAME. I have 3 javascript functions create(), update() etc. These javascripts are called onclick() for these buttons. In thse functions first I set unique value to this hiddent field appropriately. Then submit the form. Note that all 3 buttons now go to same common action in the JPF. The code is like this.
    document.getElementById("ACTION_NAME").value = "UPDATE";
    document.getElementById("batchForm").submit.
    Inside the pageflow common method, I retriev this hidden field value and based on its value, I call one of the above 3 methods in pageflow. This works for me. There may be better solution.
    3. Another usecase that I want to share and may be help others also. Most of the time very common usecase is, when we select a item in a drop bos or netui:select, we want to invoke the pageflow action. Say we have 2 dropdown boxes with States and Cities. Anytime States select box is changed, it should go back to server and get new list of Cities for that state. (We can get both states and cities and do all string tokenizer on jsp itself. But inreality as per business needs, we do have to go to server to get dynamic values. Here is the code snippet that I use and it works for all my select boxes onChange event.
    This entire lines of code should do what we want.
    <netui:anchor action="selectArticleChanged" formSubmit="true" tagId="selectPropertyAction"/>                    
    <netui:select onChange="document.getElementById(lookupIdByTagId('selectPropertyAction',this )).onclick();" dataSource="pageFlow.selectedArticleId" >
    <c:forEach items="${requestScope.ALL_ARTICLE}" var="eachArticle">
    <%-- workshop:varType="com.hid.iod.forms.IoDProfileArticleRelForm" --%>
    <netui:selectOption value="${eachArticle.articleIdAsString}">${eachArticle.articleItemName}</netui:selectOption>
    </c:forEach>               
    </netui:select>
    See if you can build along those above lines of code. Any other simpler approches are highly welcome.
    Thanks
    Ravi Jegga

Maybe you are looking for

  • Dynamic text in a mc

    I made a Movie clip inside is a dynamic text field. I have assigned an instance name to the text field and embedded the font. On my stage I have two instances of this MC, but only one displays the text I tell it with code. Each MC has a unique instan

  • Facetime not connecting - macbook pro germany

    I am having problems with using facetime on my macbook pro, OS X Lion 10.7.4, bought in Germany in September 2011. Facetime opens, the camera works, incoming connections are admitted (within the security settings), facetime contact on the other side

  • Any way to back up Time Capsule with Time Machine?

    Im now using my time capsule as a normal external drive and using a drobo for time machine...but it isnt backing up everything on my time capsule. Is there a way of making it do so? Cheers

  • Slideshow in pse8 for mac

    Um. I'm trying to create a sldeshow that I can upload to youtube.  When I click create/create pdf slideshow it opens bridge and allows selection of some pictures, but never does anything else.  I read the threads here about this whih described the sl

  • Stuck on overwrite question unzipping files

    Hi guys! I've created a script that extract zip files (7z and zip extensions) but i've got a problem with overwriting. Clear-Host Function Find-Files(){ [CmdletBinding()] param( [Parameter(Mandatory=$true,Position=0)][string]$Path, [Parameter(Mandato