11 Replies Latest reply: Nov 30, 2012 4:43 AM by Tolls RSS

    pass Map or set value to String

    Tshifhiwa
      hi i have a situation where i have to pass my string value to set method
      its not working its complaning about not able to invoke

      am in jdeveloper 11.1.1.6.0

      Edited by: adf0994 on 2012/11/30 9:36 AM
        • 1. Re: pass Map or set value to String
          EJP
          its complaning about not able to invoke
          I find it impossible to believe that the exception or error message you are getting consists solely of the words 'not able to invoke'.

          You can't get anywhere in this business by forgetting to provide critical informatiion, or by paraphrasing messages into what you think they mean. It is a waste of your time and loses information.

          Post the actual message.*
          • 2. Re: pass Map or set value to String
            gimbal2
            EJP wrote:
            Post the actual message.*
            Including the stacktrace, if there is one.
            • 3. Re: pass Map or set value to String
              Tshifhiwa
              the actual meaasge is Error(431,13): assignRoleToUsers(java.lang.String,java.util.Map) in OIDOperations cannot be applied to (java.lang.String,java.lang.String) there is no stack trace
              i try to pass like this
                       String users = null;
                       OIDOperations resu = new OIDOperations();
                       AddmemberBean add = new AddmemberBean();
                      // add.getName(users);
                       add.setName(users);
                  //resu.assignRolesToUser(add., userName)
                      resu.assignRoleToUsers(name,users ); 
              • 4. Re: pass Map or set value to String
                Kayaman
                You're calling the wrong method. Easy to confuse since the names are so similar.
                • 5. Re: pass Map or set value to String
                  Tshifhiwa
                  if i call the other method i still get an error
                  Error(433,13): assignRolesToUser(java.util.Set,java.lang.String) in OIDOperations cannot be applied to (java.lang.String,java.lang.String)
                  • 6. Re: pass Map or set value to String
                    Tolls
                    Kayaman wrote:
                    You're calling the wrong method. Easy to confuse since the names are so similar.
                    Except neither of those methods takes a pair of Strings.
                    One takes (String, Map) and the other takes (Set, String).
                    The OP needs to decide exactly what it is they are trying to achieve, then maybe they can figure out which of those two methods they should be choosing.
                    • 7. Re: pass Map or set value to String
                      Tshifhiwa
                      i what to pass string value to this method
                       public Set assignRoleToUsers(String roleName,Map users){
                      • 8. Re: pass Map or set value to String
                        Kayaman
                        adf0994 wrote:
                        i what to pass string value to this method
                        public Set assignRoleToUsers(String roleName,Map users){
                        But you can't. It needs a Map. You could try putting the String in a map, but would you use it as the key or the value?
                        • 9. Re: pass Map or set value to String
                          Tshifhiwa
                          i will used it as value
                          i try this but am geting null/NPE error
                              javax.faces.event.ActionEvent actionEvent = null;
                             
                                   
                                   OIDOperations resu = new OIDOperations();
                                   AddmemberBean add = new AddmemberBean();
                                  Map users = (Map)actionEvent.getComponent().getAttributes().get(add.getName());
                                  resu.assignRoleToUsers(name,users );   
                          the error is in this line Map users = (Map)actionEvent.getComponent().getAttributes().get(add.getName());,the thing is this is the train flow so am entering values in another screen and passing then in another screen,so i think when i get to another screen the previous screen capture value are null,how can i get thos entered value from previous screen
                          Caused by: javax.faces.el.EvaluationException: java.lang.NullPointerException
                               at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:51)
                               at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
                               at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190)
                               at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:92)
                               at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:361)
                               at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:96)
                               at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:102)
                               at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:92)
                               at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:361)
                               at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:96)
                               at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:96)
                               at oracle.adf.view.rich.component.fragment.UIXRegion.broadcast(UIXRegion.java:148)
                               at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.broadcastEvents(LifecycleImpl.java:1018)
                               at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:386)
                               at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:194)
                               at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
                               ... 38 more
                          Caused by: java.lang.NullPointerException
                               at OrgDetails.GetNextStopPayment(OrgDetails.java:461)
                               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                               at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                               at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                               at java.lang.reflect.Method.invoke(Method.java:597)
                               at com.sun.el.parser.AstValue.invoke(Unknown Source)
                               at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
                               at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:46)

                          Edited by: adf0994 on 2012/11/28 4:37 PM

                          Edited by: adf0994 on 2012/11/28 5:02 PM
                          • 10. Re: pass Map or set value to String
                            Tshifhiwa
                            Map<Object,String> mp=new HashMap<Object, String>();

                            // adding or set elements in Map by put method key and value pair
                            mp.put(new Integer(2), "Two");
                            mp.put(new Integer(1), "One");
                            mp.put(new Integer(3), "Three");
                            mp.put(new Integer(4), "Four");
                            • 11. Re: pass Map or set value to String
                              Tolls
                              Do you have a question, or are you just guessing at what your method actually requires?