Dynamic Imagelink Component - Calling Impl method with input parameter

Hi All,
I have requirement where Imagelinks are created dynamically on the pageload. Generated the components and the components are displayed on the jspx.
Now when I click the image link, a method in AMImpl should invoke and this method takes some input parameters.
I am able to call the method successfully in AMimpl with the help of below code. But I could not understand how to pass the input parameters to that method.
                           RichCommandImageLink lockimageLink =
                            new RichCommandImageLink();
                        lockimageLink.setIcon("icon.png");
                        lockimageLink.setId("icon" + index);                   
                        MethodExpression me =
                            JSFUtils.getMethodExpression("#{bindings." +
                                                         "MyMethodName" +
                                                         ".execute}");
                        lockimageLink.addActionListener(new MethodExpressionActionListener(me));
  public static MethodExpression getMethodExpression(String name) { 
   Class [] argtypes = new Class[1]; 
   argtypes[0] = ActionEvent.class; 
   FacesContext facesCtx = FacesContext.getCurrentInstance(); 
   Application app = facesCtx.getApplication(); 
   ExpressionFactory elFactory = app.getExpressionFactory(); 
   ELContext elContext = facesCtx.getELContext(); 
   return elFactory.createMethodExpression(elContext,name,null,argtypes); 
  } Can some one please suggest how to pass input parameters to the Impl method.
Jdeveloper Version : 11.1.1.4.0
Thanks,
Morgan.
Edited by: 900114 on May 12, 2012 11:23 PM

You can use the below method to call an AMImpl method. You can pass parameters as well to the AMImpl method.
DCBindingContainer bindings = getDCBindingContainer();
OperationBinding ob = bc.getOperationBinding("MyMethodName");
Map m = ob.getParamsMap();
ob.put("paramName", "paramValue"); paramName is the parameter in AMImpl and paramValue is the value to be passed.
ob.execute();
Where getDCBindingContainer() is:
public DCBindingContainer getDCBindingContainer() {
ExpressionFactory exprFactory;
ELContext elContext;
ValueExpression valueExpression;
DCBindingContainer dcBindingContainer;
FacesContext facesContext = FacesContext.getCurrentInstance();
exprFactory = facesContext.getApplication().getExpressionFactory();
elContext = facesContext.getELContext();
valueExpression =
exprFactory.createValueExpression(elContext, "#{bindings}",
Object.class);
dcBindingContainer =
(DCBindingContainer)valueExpression.getValue(elContext);
return dcBindingContainer;
Hope this helps
Edited by: umesh.agarwal on May 13, 2012 12:10 AM
Edited by: umesh.agarwal on May 13, 2012 12:10 AM

Similar Messages

  • Using Java Reflection to call a method with int parameter

    Hi,
    Could someone please tell me how can i use the invoke() of the Method class to call an method wiht int parameter? The invoke() takes an array of Object, but I need to pass in an array of int.
    For example I have a setI(int i) in my class.
    Class[] INT_PARAMETER_TYPES = new Class[] {Integer.TYPE };
    Method method = targetClass.getMethod(methodName, INT_PARAMETER_TYPES);
    Object[] args = new Object[] {4}; // won't work, type mismatch
    int[] args = new int[] {4}; // won't work, type mismatch
    method.invoke(target, args);
    thanks for any help.

    Object[] args = new Object[] {4}; // won't work, type
    mismatchShould be:
        Object[] args = new Object[] { new Integer(4) };The relevant part of the JavaDoc for Method.invoke(): "If the corresponding formal parameter has a primitive type, an unwrapping conversion is attempted to convert the object value to a value of a primitive type. If this attempt fails, the invocation throws an IllegalArgumentException. "
    I suppose you could pass in any Number (eg, Double instead of Integer), but that's just speculation.

  • How to do this: Link which calls a methode with a parameter?

    Hello!
    I have a small question:
    I have a jsp-site with some beans.
    On the jsp-site I have the following code which isnt functional:
    <c:forEach items="${filter.resultlist}" var="result">
        <c:url action="#{filter.selectedAoid(result.aoid)}">
             <c:out value="${result.name}" / >
         </c:url>
    </c:forEach>-> As you can see:
    I want to make a Link, which is named like the String in the List and accessable by ${result.name} and on a click it should run "filter.selectedAoid()" with an int Parameter.
    (So I can access the right object with my Aoid-identifier...)
    The List comes from a DB and I am able to access the values of the Objects in the list.
    Could someone please tell me how that is done?
    Thanks in advance
    Fuchur

    One way of hacking this problem is by dynamically updating the job step which executes the stored procedure to include the parameters the user provided.  You can do so by using
    msdb.dbo.sp_update_jobstep.
    So for example, you could create a job named "Test job" and in that job the first step would be to execute your stored procedure.  You would then use the following code to update that step at run time:
    execute msdb.dbo.sp_update_jobstep
    @job_name = N'Test job',
    @step_id = 1,
    @command = 'execute my_proc @my_variable = ''my_value'''
    You'd then use sp_start_job like so:
    execute msdb.dbo.sp_start_job @job_name = 'Test job'
    Your job would then execute using the value provided at run time for the @my_variable parameter.

  • Calling a method with a string

    Here's the question:
    I want to call a method with the name equal to a string variable.
    For example, if the string variable contains "hellojava" , i'd like the hellojava() method to be called..
    if the string contains "error", the error() method should be called..
    and so on..:)

    Here is an example I had thrown together for this
    purpose of the exact demonstration, Ar'nt you in luck.:-). If there is anything you don't understand,
    I can be reached at [email protected] and will be happy to help....
    import java.lang.reflect.*;
    import java.io.*;
    class Test {
         String name = "Default";
            public Test(String name) {
                    this.name = name;
            public void test() {
                    System.out.println("Hello");
         public void count() {
              for(int i=0; i<10; i++) {
                   System.out.println(i);
           public static void main(String[] args) {
                 try {
                         Test myObject = new Test("test1");
                             Class myClass = myObject.getClass();
                   BufferedReader bRead =
                        new BufferedReader(
                        new InputStreamReader( System.in ));
                   String bufStr = null;
                   while( (bufStr = bRead.readLine()) != "exit") {
                         Method noParams = myClass.getDeclaredMethod(bufStr, new Class[] {});
                              noParams.invoke(myObject, new Object[] {});
                }catch(Exception e) {
                   System.out.println("No Such Method.");
    }Good Luck,
    -- Ian

  • Calling a method with parameters in jstl?

    i need to call a method with a series of String parameters what am i doing wrong?
    the java
        public ArrayList getEmployeeSkills(String ename, String snmae, String yearsexp)the jstl
        <jsp:useBean id="empskill" class="com.Database.EmployeeSkill"/>
        <c:forEach var="emp" items="${empskill.EmployeeSkills(null, null, null)}">
        </c:forEach>

    this works:
         <jsp:useBean id="empskill" class="com.Database.EmployeeSkill" scope="page">
             <jsp:setProperty name="empskill" property="ename" value="Helen Smith"/>
             <jsp:setProperty name="empskill" property="sname" value="Java"/>
         </jsp:useBean>but this part isnt:
         <c:forEach var="empskill" items="${empskill.EmployeeSkillsReport}">
         </c:forEach>ive removed the get part from the method as i have done before from the java class it is calling:
    public ArrayList getEmployeeSkillsReport()
    but it produces:
    org.apache.jasper.JasperException: Exception in JSP: /main.jsp:146
    143:      </jsp:useBean>
    144:      
    145:
    146:      <c:forEach var="empskill" items="${empskill.EmployeeSkillsReport}">
    147:      </c:forEach>
    148:                          
    149:    
    Stacktrace:
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:506)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    javax.servlet.ServletException: An error occurred while evaluating custom action attribute "items" with value "${empskill.EmployeeSkillsReport}": Unable to find a value for "EmployeeSkillsReport" in object of class "com.Database.EmployeeSkill" using operator "." (null)
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:843)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:776)
         org.apache.jsp.main_jsp._jspService(main_jsp.java:244)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "items" with value "${empskill.EmployeeSkillsReport}": Unable to find a value for "EmployeeSkillsReport" in object of class "com.Database.EmployeeSkill" using operator "." (null)
         org.apache.taglibs.standard.lang.jstl.Evaluator.evaluate(Evaluator.java:109)
         org.apache.taglibs.standard.lang.jstl.Evaluator.evaluate(Evaluator.java:129)
         org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager.evaluate(ExpressionEvaluatorManager.java:75)
         org.apache.taglibs.standard.tag.el.core.ForEachTag.evaluateExpressions(ForEachTag.java:155)
         org.apache.taglibs.standard.tag.el.core.ForEachTag.doStartTag(ForEachTag.java:66)
         org.apache.jsp.main_jsp._jspx_meth_c_forEach_3(main_jsp.java:590)
         org.apache.jsp.main_jsp._jspService(main_jsp.java:232)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

  • BAM Report with input parameter

    Hi,
    How to design a report with input parameter? BAM ADC contains data about different clients.
    I have to design a report which iterates over these clients and display one client info at a time.
    Thanks
    Samatha

    Instructions in User guide on how to create surface prompts
    http://www.oracle.com/technology/products/integration/bam/index.html> 11g Documentation> User guide
    http://download.oracle.com/docs/cd/E12839_01/integration.1111/e10230/prompts_parameters.htm#CHDEEACD
    Also look at call center -->Reassign cases sample under demos in BAM 11g.

  • Calling a method with a html Submit button

    hi guys,
    is it possible to call a method from a JSP file using a HTML submit button. I know i can call another website easily doing it this way, is there a similar way available to call a method once the button is clicked?
    FYI
    The method is in a bean file named jdbc. The methods name is getUsername.
    Nice one.
    <form action = <%jdbc.getUsername()%> <input type="submit" value="Submit">

    Dear friend,
    you mentioned that u need to call a method when submit button is clicked. Is the method dynamically created. If not so, then you can include the method on the submit button html file itself.
    Regards,
    Rengaraj.R

  • Call Tcode S_alr_87013560 with input values when  execute the workitem

    hi all
    My requirment is to call report S_alr_87013560 with value in input fields ,when user execute the work item .
    this report needs input 1 - controlling area
    on next screen--- 2- Database profile .
    then project ID  and cost...
    and this is the first activity of workflow definition.
    Please advice me on the same.
    Thanks in advance.
    Deepanker Dwivedi

    Hello,
    Put whatever you need to do in a method of the BO associated with the workflow,
    and then create a task (TS....) that calls that method. Then the step in the
    workflow calls that task.
    To call a report as you describe I'd guess you'd need to do a SUBMIT with BDC data.
    regards
    Rick Bakker
    Hanabi Technology

  • Call a method with complex data type from a DLL file

    Hi,
    I have a win32 API with a dll file, and I am trying to call some methods from it in the labview. To do this, I used the import library wizard, and everything is working as expected. The only problem which I have is with a method with complex data type as return type (a vector). According to this link, import library wizard can not import methods with complex data type.
    The name of this method is this:   const std::vector< BlackfinInterfaces::Count > Counts ()
    where Count is a structure defined as below:
    struct Count
       Count() : countTime(0) {}
       std::vector<unsigned long> countLines;
       time_t countTime;
    It seems that I should manually use the Call Library Function Node. How can I configure parameters for the above method?

    You cannot configure Call Library Function Node to call this function.  LabVIEW has no way to pass a C++ class such as vector to a DLL.

  • JDBC-Adapter-Receiver Calling Stored Procedure with Input-Typ Record

    Hallo,
    I´ m trying calling a stored-procedure with two input-parameter; one of typ record (oracle) and one of type tabel of records. Is this possible (I think there are only types like string, integer etc. possible)? When not is there another possibility to work with that type?
    Thanks in advance,
    Frank

    Hi Frank,
    I think stored procedures will not take Array of Records as a Input. If you want to make a loop funtionality etc then JDBC adapter will work accordingly. You need to just call the stored procedure from the JDBC adapter. It will work for the array of records(multiple occurences).
    Receiver JDBC Procedures.
    /people/siva.maranani/blog/2005/05/21/jdbc-stored-procedures
    Alternative option is you can make use of Java Proxy and from there you can call stored procedure ..I think it is possible.. not tried.
    Hope this helps
    Regards,
    Moorthy

  • Calling a taskflow with input parameters in a page template

    Hi,
    I have a taskFlow with an inputParameter, a page template with an attribute and a fragment using this template.
    My fragment is passing #{bindings.MyColumn.inputValue} to the template attribute, where bindings.MyColumn is an attributeValues pointing to an iterator.
    My template is calling the taskFlow and pass #{attrs.myColumn} to the input parameter. There is an outputText too, displaying #{attrs.myColumn}.
    +fragment -- #{bindings.MyColumn.inputValue} --> template -- #{attrs.myColumn} --> taskFlow+
    The problem is that #{attrs.myColumn} is resolved to null when is passed to the taskFlow inputParameter. But in the outputText value, #{attrs.myColumn} is resolved to the good value.
    I don't understand what is happening.
    If I pass #{data.fragmentPageDef.MyColumn.inputValue} directly from my template to the taskFlow input parameter it works, but no with #{attrs.myColumn}.
    How can I do to pass a template attribute to a taskFlow inputParameter?

    I think it is more something with ADF lifecycle.
    Something like : #{attrs.myColumn} is resolved in a phase and the taskFlow in another. I don't know.
    I am trying to understand what is done when. I think the answer is in "Prepare Model" and "Prepare Render" phases, but I am far to understand all this...
    Any help is welcomed.

  • Calling arbitrary method with expression language

    I'm new to JSP, but have a strong background in Java. I've created a bean that I've included on a JSP page that is meant to manage access to a database. On this bean I have a method
    public int createNewRecord();which will create a new record and return its id. I then want to embed this id in a link within my webpage by using something like:
    <jsp:useBean id="dbBean" scope="application" class="com.myDomain.DatabaseIfaceBean"/>
    <html>
    <body>
    Link to <a href="relativePage.jsp?recordId=${dbBean.createNewRecord}">record page</a>
    </body>
    </html>However, this doesn't work. Is there a way to call this method? If this method accepted arguments, is there some way I could pass arguments to it?

    Its a bit long winded, but EL functions would be the way to go. [url http://www.sitepoint.com/article/java-6-steps-mvc-web-apps/6]Here's  a link (search for EL functions in the page)
    ram.

  • Calling varargs method without varargs parameter.

    Hello
    I really appreciate your help on clarifying the following problem.
    1) I have method signature as
    public User validateUser(User usr, boolean isLogin,Object...args)
    2) When I call this method as
    obj.validateUser(usrObject,true);
    In windows environment, the method implementation specified in 1) is called and no issues.
    But, when the same code is deployed on linux, I get the following error
    java.lang.NoSuchMethodError: com.mysubpackage.dao.myobject.*validateUser(Lcom/startf orce/system/User;Z)Lcom/startforce/system/User;*
    Please let me know, if there is any known incompatibility issue out there between windows and linux.
    Thanks
    Muthu

    Hi Jverd
    You are right! I think I worked too much and got lost somewhere, to prove me wrong I wrote the following test class and ran on both linux and windows and produced the same result (as it should). -:) Thanks all of you for responding.
    public class VarArgsTest {
          * @param args
         public static void main(String[] args) {
               VarArgsTest test = new VarArgsTest();
               System.out.println("\nCalling varArgs with two parameter as test.printVarArgs(\"I am Param1 Value\", \"I am Param2 value\")");
               test.printVarArgs("I am Param1 Value", "I am Param2 value");
               System.out.println("Calling varArgs with three parameter as test.printVarArgs(\"I am Param1 Value\", \"I am Param2 value\", \"I am Param3 value\")");
               test.printVarArgs("I am Param1 Value", "I am Param2 value","I am Param2 value");
         public void printVarArgs(String param1, String param2, Object...objects) {
              System.out.println("\nparam1 = "+param1+"\nparam2 = "+param2);
              System.out.println();
              System.out.println(" param3 [Object...objects] length = "+objects.length);
              System.out.println();
              if(objects.length > 0)
                   System.out.println("Param 3 is not empty and its first value is  = "+objects[0]);
              else
                   System.out.println("Param 3 is  empty and nothing to display, it is an empty array ");
    Output
    Calling varArgs with two parameter as test.printVarArgs("I am Param1 Value", "I am Param2 value")
    param1 = I am Param1 Value
    param2 = I am Param2 value
    param3 [Object...objects] length = 0
    Param 3 is empty and nothing to display, it is an empty array
    Calling varArgs with three parameter as test.printVarArgs("I am Param1 Value", "I am Param2 value", "I am Param3 value")
    param1 = I am Param1 Value
    param2 = I am Param2 value
    param3 [Object...objects] length = 1
    Param 3 is not empty and its first value is = I am Param2 value
    Edited by: Startup_Muthu on Mar 12, 2008 11:41 AM
    Edited by: Startup_Muthu on Mar 12, 2008 11:43 AM

  • Multible MBO's with input parameter's how to pass them?

    Hello gurus i'm currently working on native app that based on BAPI MBO's and each MBO takes input parameter and return some values
    at the first MBO i made the input parameter is personalization key but after adding a second MBO and make the same to the second MBO when i generated the code and passing the PK values only for the first MBO i got an error
    any help on how to pass input parameters for native app that based on BAPI for multiple MBO and i will not pass all the parameters at the same time depend on the screen that i'm in i will call MBO
    thanks in advance

    Steps to do a sync from MBO is given below (android native app):
    Create MBO and PK.
    Map MBO load parameter with PK.
    Create Second MBO and another PK (or use existing PK if the input parameter of first MBO is same as second MBO).
    Map Second MBO load parameter with second PK.
    Sample native code (android):
    //Assing Values to PK
    PersonalizationParameters param = CustomersDB.getPersonalizationParameters();
              param.setPK_CustomerInput("1001");
              param.save();
              CustomersDB.subscribe();
    //Make a blocking synchronize call to Unwired Server to pull in all MBO data
              CustomersDB.synchronize();
    //Finall is the query generated by SUP to get the data from the table Customers.
    //Customers is the MBO name in SUP and table name in Device DB
    Customers.findAll()
    Give the steps you performed with relevant screen shots to help you further.
    More info, Developing SAP Android Mobile app from scratch - Part 4
    Midhun VP

  • Enhance method with new parameter

    How can I enhance an existing method with a new Parameter?
    In some tutorial is written that this should be possible. But there is no exact description.

    Thx Rich Heilman 
    but in the Doku "Enhancements to Global Classes and Interfaces"
    http://help.sap.com/saphelp_nw70/helpdata/en/58/4fb541d3d52d31e10000000a155106/content.htm
    you find:
    You can enhance the components of a global class or global interface by:
    &#9679;     Inserting new, optional formal parameters for existing methods (but no new exceptions)

Maybe you are looking for

  • Crystal Report Toolbar images not displaying properly in IE?

    Hi, I am using VisualStudio 2012 ,crystal report version 13.0.2000.0 and sp5. My problem is that after loading crystal report, toolbar image icons (such as print,export etc) are not showing properly in internet explorer(version ie10). But it is displ

  • Third party sales issue

    hi experts,       can any body explain in third party sales where do we see migo, miro, if possible step by step process. thanks in advance

  • Errors being used by a bean in wls8.1

    i have many ss ejbs running in wls 6.1 under domain1. i have one ss ejb (called Submit) running in wls 6.1 under domain2 which makes calls to the beans in domain1. this is working fine. i'm migrating domain2 to use wls8.1, and am getting all kinds of

  • Existing 1811W, need to turn on wireless

    I have an existing Cisco 1811W router, running just fine, but now I need to turn on wireless. All of the web docs that I see seem to involve turning on bridging? shouldn't it be sufficient just to put the Dot11Radio0 and Dot11Radio1 interfaces into t

  • Web service ClassCastException in the generated Tie class

    I got the above exception when making a request from a client to an EJB webservice. The exception is in the generated tie class on the server side. I narrowed down the problem to this: In my function call in the tie class: (now call MyFunction): a fu