1 Reply Latest reply on Dec 15, 2008 9:42 AM by Matt Nirgue

    SeamTest invokeMethod with parameters besides primitives

    Matt Davis Newbie

      There has to be a way to do this, right? The line is something like this:


      I dug into the SeamTest code and there a bunch of inner classes and javax.el.MethodExpression objects... and I ran away.


      I am hoping this is such a common question that there is an easy way to do it... all the examples show methods that have no parameters, which scares me.


      This works ok:


      invokeMethod("#{registrationBean.deleteAccount('+username+')}");
      



      But what about complex arguments? Is this typically not done when using Seam with JSF? I'm using it with Flex and Granite, so maybe I'm just doing things weird.



        • 1. Re: SeamTest invokeMethod with parameters besides primitives
          Matt Nirgue Newbie

          Hi Matt


          if you want to invoke methods with parameter(s) you need to get your component first then use it to call your method... Here's an example:



          RegistrationBean registrationBean = (RegistrationBean) getInstance("registrationBean");
          //or
          //RegistrationBean registrationBean = (RegistrationBean) getInstance(RegistrationBean.class);
          //or
          //RegistrationBean registrationBean = (RegistrationBean) getValue("#{registrationBean}");
          
          registrationBean.deleteAccount(0, "test", yourNonPrimitiveObject, null);



          Hope this helps you... :)


          Matt