Method as a parameter (facelts)

Hello...
I have rich modal panel for a yes/no confirmation...and i want to give it a method parameter, what to do, if user wants to perform an action...I wrote the code, but nothing happens, when user confirms the question...
thanks for your opinions
Pavel
Modal panel as a custom tag
     <rich:modalPanel id="#{id}" width="350" height="100">
          <f:facet name="header">
               <h:panelGroup>
                    <h:outputText value="Modal Panel"></h:outputText>
               </h:panelGroup>
          </f:facet>
          <f:facet name="controls">
               <h:panelGroup>
                    <h:graphicImage value="/images/modal/close.png"
                         styleClass="hidelink" id="hidelink" />
                    <rich:componentControl for="panel" attachTo="hidelink"
                         operation="hide" event="onclick" />
               </h:panelGroup>
          </f:facet>
          <h:form>
               <h:outputText value="Skutecne si prejete provest akci?" />
               <rich:message showSummary="false" showDetail="true"
                    for="categoryName" />
               <h:commandButton id="cancel" value="Cancel">
                    <rich:componentControl for="#{id}" attachTo="cancel"
                         operation="hide" event="onclick" />
               </h:commandButton>
               <a4j:commandButton value="Odeslat"
                    action="#{action}"></a4j:commandButton> //<====================== the method should be invoked here
          </h:form>
     </rich:modalPanel>parameters set in main file
<pm:modalYesNo action="#{categoryBean.deleteCategory}" id="deletePanel" /> //categoryBean.deleteCategory is the method i want to call, if user confirmsThe method itself
     public String deleteCategory(){
          categoryService.remove(categoryService.getById(selectedEntity));
          System.out.print("deleting category");
          return "success";
     }

Pieter

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 pass table to in a method as a parameter

    Hi
    I need to pass one table in one method to another method as a parameter.
    ex: it_tab type zvalue(DDIC).
         send_mail( it_tab)like this i need to pass. How to do this.
    Please help me.
    Thanks & Regards
    SUN

    Hello,
    You'll need a table category that has the same structure of your internal table. Suppose you need to pass an internal table of type SCARR: you'll actually pass a parameter of type SCARR_TAB (look for it into tcode SE11).
    Remember that in a OOP scope, you cannot have header line in your internal tables.
    Regards,
    Andre

  • 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)

  • Dump while executing class method whose exporting parameter  of type table

    hi,
    i am getting dump after executing a method in which i want to export an internal table which will hold all the states name along with its code on the basis of the country name which is my importing parameter.
    for the above i am using importing parameter named as country of type too5u-land1 and the exporting parameter named as itab of type table and below is my code for the requirement.
    method PROCESS.
      select BLAND BEZEI from T005U
             INTO TABLE ITAB WHERE
             LAND1 = COUNTRY.
    endmethod.

    Hi,
      Please check the below code
    parameters country type land1.
    *Refer the class which we are using like below
    data: a type ref to ZCL_TX_SERVICE_01.
    data itab type ycountry.
    *ycountry is a table type defined in dictionary with fields BLAND and BEZEI
    data wa like line of itab.
    *If we are using instance method we need  to create the instance like below
    create object a.
    *In the method process define exporting parameter itab as type ycountry which is a table type already defined
    CALL METHOD a->PROCESS
      EXPORTING
        COUNTRY = country
      IMPORTING
        ITAB    = itab.
    loop at itab into wa.
    write:/ wa-bland.
    endloop.
    Regards
    Dande

  • 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

  • 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

  • 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

  • Creating a method with ByRef parameter

    Hi All,
    when i am creating a method with parameter as ByRef, i am getting the message as fallows.
    Please use valid signature.
    help me to overcome frojm this.
    Thanks in advance.
    With Regards
    Raju

    Hi,
    strange... I even thought that ByRef is default parameter type for sub... maybe you can try this.
    Or try to create your sub directly in the project file, maybe then you will have a proper error message from MS.
    Regards,
    Wolfhard

  • Reference to variables using method w/ string parameter?

    I've done some programming before, but not too much in Java, so bear with me please.
    Basically, what I'm trying to do is find a static method with a string parameter that can serve as a variable reference. Here's an example of what I mean.
    Say that the method is "toVariableReference", with a string paramter. Then, to refer to a variable x1, I could refer to it as follows:
    x1
    OR
    toVariableReference("x1")
    See?
    Now, if you don't see the point yet, the reason I'm trying to figure this out is because if I wanted to check if nine integer primitive data identifiers contain values greater than 500, instead of having 9 if statements, I could do the following:
    for (x=1; x<10; x++)
    if (toVariableReference("int"+x)>500)
    <statements>
    Since this theoretical method has a string parameter, one could concatenate an integer counter to it, as I have done above.
    Now, the big question. Is there such a method that, when invoked, does what I have described? If so, what is it, and what java packages would I need to import for its usage?
    Thank you for your time!
    -Katsarephat

    Yes, you can change array entries. You might want to take a look at the Java Tutorial:
    http://java.sun.com/docs/books/tutorial/
    The "Learning the Java Language" link has some information about arrays (and many other things).

  • 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.

  • BOR Method No Importing Parameter

    Hello All,
    I have a task value (&_WORKITEM.CREATEDBYUSER.ID&) that I am trying to pass to a BOR method.
    The binding from the task to the method has been defined in the task correctly.  (I think...)
    The BOR Method is using the following statement:
    SWC_GET_ELEMENT container 'UserName1' username1.
    However I receive SY-SUBRC = 8.
    I do not understand what could be wrong so I populated the Initial Value of the task container 'UserName1' with value 'ANYTHING'.
    The BOR method imported the value "ANYTHING".  This indicates to me:
    - the binding is correct ,
    - the BOR Method import is correct, and
    - I checked SWI1 and the value &_WORKITEM.CREATEDBYUSER.ID& is populated too
    So why can I not import it the value into the method?
    Please help,
    Aaron

    I discovered, after logging into the system this morning, that it works.
    The method imports the value from the task.  Sy-Subrc = 0.  Hurray!
    A co-worker explained to me that the buffer needed to be reset.  T-Code SWU_OBUF would do this and this T-Code should be executed after changes are made to workflow objects.
    Thanks to all for responding,
    Aaron

  • Jaxp xpath evaluate method node list parameter?

    The javadoc for XPath.evaluate(String, Object, QName) says that the second parameter is the context "node or node list for example". I'm familiar with the concept of an XPath context node. What does it mean to pass a node list as the second argument?
    With Xalan 2.7 and this xml:
    <doc><a/></a></doc>
    NodeList nl = (NodeList) xp.evaluate("//*", doc, XPathConstants.NODESET);
    Number n = (Number) xp.evaluate("count(self::node())", nl, XPathConstants.NUMBER);
    Results in zero.
    NodeList nl2 = (NodeList) xp.evaluate("self::node()", nl, XPathConstants.NODESET);
    Results in an empty node list.
    Message was edited by:
    queshaw

    Specify the XML document as the context node.
    InputSource inputSource =
        new InputSource(new FileInputStream(xmlDocument)));xmlDocument is the java.io.File object of the XML document.
    NodeSet nodes =
        (NodeSet) xPath.evaluate(xpathExpression,
            inputSource, XPathConstants.NODESET);

  • Problem calling a method which takes a parameter from a table

    Hi guys,
    I'm very new to jsf and hope you can help me out.
    On my page i'm generating a list, which is working fine. now i want to add some commandLinks to the list entries. on click, i want to execute a bean method, which takes a parameter from the list, generates a picture and displays it on my page.
    here's a piece of code thats already working:
    <rich:dataTable var="data" value="#{pathwayBean.orgList}">
    <rich:columnGroup>     
            <rich:column>     
               <h:outputText value="#{data.name}" />
         </rich:column>
    </rich:columnGroup>
    </rich:dataTable>now, i want to replace the outputText with a commandLink, and execute a method with {data.id} as parameter. Unfortunately, the commandLink property "action" can only call bean methods with no parameter, or is that wrong?
    Thanks in advance,
    Alex

    use actionlistener.
    here a typical code that works fine for me:
    (JSF 1.2)
    //Java
    private Integer selectedItemId=null;
         public void selectItem(ActionEvent event) {
              // Find the UIParameter component by expression
              UIParameter component = (UIParameter) event.getComponent().findComponent("itemId");
              // parse the value of the UIParameter component
              try {
                   selectedItemId = Integer.parseInt(component.getValue().toString());
                   // find itemBean here using selectedItemId
              } catch (Exception e) {
                   logger.error(e, e);
              logger.info(" +++ selectedItemId =" + selectedItemId);
         public String viewItem() {
                 //create view beans here
                 return "itemView";//return appropriate view.
    //JSF
    <h:column>
                             <h:commandLink     id="View"
                                                 action="#{itemListBean.viewItem}"
                                                       actionListener="#{itemListBean.selectItem}">
                                  <h:outputText value="select"/>
                                  <f:param id="itemId" name="itemId" value="#{itemBean.id}"/>
                             </h:commandLink>
                     </h:column>

  • Field symbols values passing as parameter to Methods

    Hi ,
    Can we pass fields symbols as parameter to methods ? I want to use field symbols values in my where in clause in methods, thereafter I want to pass my internal table to calling method.
    Thanks,
    Ujjwal

    Hi,
    I have create an class in which have I have create a method to written a select query to extract value from a table. The table name is passed by user. the select used is:
    select * from (tab) into CORRESPONDING FIELDS OF TABLE data.
    this method has 2 parameter:
    tab of type sting (importing).
    data of type ANY TABLE (exporting).
    and i am using the following code to get the data:
    data:  itab TYPE TABLE OF t578w.
    field-SYMBOLS <ab> TYPE any.
    ASSIGN 'T578W' to <ab>.
    CALL METHOD Z_GET_TABLE_DATA=>GET_TABLE " Z_GET_TABLE_DATA is the class name & GET_TABLE  is method name
        EXPORTING
          tab  = <ab>
        IMPORTING
          data = itab.
    You can code in similar way.
    I hope it helps.
    Regards
    Arjun
    Edited by: Arjun Thakur on Apr 23, 2009 3:16 PM

Maybe you are looking for