Writing method with if

public class positiveornegative {
    public static String numbercheck (int number){
         if (number<=0){
              System.out.println(false);
              return ;
         else if (number>0){
              System.out.println(true);
              return ;     
    public static void main(String[] args) {
         System.out.println(numbercheck(3));
}I want to make a method which which will return true if a given number is positive, and false otherwise. How can i use boolean or something else rather than writing println(true) or println(false). and what should i write after return??

I understand how u did but i want to do it with if but i couldn't apply it into the return statement.
public static boolean numbercheck (int number){
                    return      if (number<=0){
                         false;
                   return if (number>0) {
                        true;     
                   }is it going to be something like this?

Similar Messages

  • (view hint or Query  writing method) using views in Select Query

    Need Assistance,
    Hi all,
    My database having many views. while i am joining the views in a select query increase the cost of the querys due to the complex joins in the conditions.
    While checking the select query with views individualy taking less cost.
    Does any hint or query writing method is availabe to avoid the merging of the execution plan of the views?
    I have browsed many related to the mentioned issues,couldn't found any thing that helps me.
    Please help me on this issue,it will be very much helpfull for me.
    Thanks,
    Senthur

    Please read the two threads linked to in the FAQ: {message:id=9360003} and post the relevant details they request, so that people can help you better with your issue.
    We cannot help if you just say "my query is slow what do I do to fix it" as we cannot see your queries, your data, or any other information we would need to help. If the answer was that simple, it would be built into oracle so that the optimiser would fix it for you.

  • Rhino calling overloaded Java methods with Array parameters

    Has anyone had any problems writing JavaScript code that calls overloaded Java methods?
    I have two Java defined methods that differ in the arguments, one takes a string the other takes an array of strings. The problem is calling Java methods within the JavaScript always calls the method with the String argument...
    /* Java Code Here */
    public void function(String s) { /* Function A */ }
    public void function(String[] sa) { /* Function B */ }
    /* JavaScript  Code Here */
    param = java.lang.reflect.Array.newInstance(java.lang.String, 2);
    param[0] = "test";
    param[1] = "test2";
    stringParam = "test3";
    /* Both function calls below end up calling the Function A from above */
    function(param);
    function(stringParam);PS...in case you're not familiar with Rhino,
    It is a mozilla package that embeds a JavaScript interpreter within a Java application...
    http://www.mozilla.org/rhino/

    haha...I can't even find my other thread :(
    Sorry about the double post...I'll go look for my other thread now

  • Issue with SharePoint foundation 2010 to use Claims Based Auth with Certificate authentication method with ADFS 2.0

    I would love some help with this issue.  I have configured my SharePoint foundation 2010 site to use Claims Based Auth with Certificate authentication method with ADFS 2.0  I have a test account set up with lab.acme.com to use the ACS.
    When I log into my site using Windows Auth, everything is great.  However when I log in and select my ACS token issuer, I get sent, to the logon page of the ADFS, after selected the ADFS method. My browser prompt me which Certificate identity I want
    to use to log in   and after 3-5 second
     and return me the logon page with error message “Authentication failed” 
    I base my setup on the technet article
    http://blogs.technet.com/b/speschka/archive/2010/07/30/configuring-sharepoint-2010-and-adfs-v2-end-to-end.aspx
    I validated than all my certificate are valid and able to retrieve the crl
    I got in eventlog id 300
    The Federation Service failed to issue a token as a result of an error during processing of the WS-Trust request.
    Request type: http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue
    Additional Data
    Exception details:
    Microsoft.IdentityModel.SecurityTokenService.FailedAuthenticationException: MSIS3019: Authentication failed. ---> System.IdentityModel.Tokens.SecurityTokenValidationException:
    ID4070: The X.509 certificate 'CN=Me, OU=People, O=Acme., C=COM' chain building failed. The certificate that was used has a trust chain that cannot be verified. Replace the certificate or change the certificateValidationMode. 'A certification chain processed
    correctly, but one of the CA certificates is not trusted by the policy provider.
    at Microsoft.IdentityModel.X509CertificateChain.Build(X509Certificate2 certificate)
    at Microsoft.IdentityModel.Tokens.X509NTAuthChainTrustValidator.Validate(X509Certificate2 certificate)
    at Microsoft.IdentityModel.Tokens.X509SecurityTokenHandler.ValidateToken(SecurityToken token)
    at Microsoft.IdentityModel.Tokens.SecurityTokenElement.GetSubject()
    at Microsoft.IdentityServer.Service.SecurityTokenService.MSISSecurityTokenService.GetOnBehalfOfPrincipal(RequestSecurityToken request, IClaimsPrincipal callerPrincipal)
    --- End of inner exception stack trace ---
    at Microsoft.IdentityServer.Service.SecurityTokenService.MSISSecurityTokenService.GetOnBehalfOfPrincipal(RequestSecurityToken request, IClaimsPrincipal callerPrincipal)
    at Microsoft.IdentityServer.Service.SecurityTokenService.MSISSecurityTokenService.BeginGetScope(IClaimsPrincipal principal, RequestSecurityToken request, AsyncCallback callback, Object state)
    at Microsoft.IdentityModel.SecurityTokenService.SecurityTokenService.BeginIssue(IClaimsPrincipal principal, RequestSecurityToken request, AsyncCallback callback, Object state)
    at Microsoft.IdentityModel.Protocols.WSTrust.WSTrustServiceContract.DispatchRequestAsyncResult..ctor(DispatchContext dispatchContext, AsyncCallback asyncCallback, Object asyncState)
    at Microsoft.IdentityModel.Protocols.WSTrust.WSTrustServiceContract.BeginDispatchRequest(DispatchContext dispatchContext, AsyncCallback asyncCallback, Object asyncState)
    at Microsoft.IdentityModel.Protocols.WSTrust.WSTrustServiceContract.ProcessCoreAsyncResult..ctor(WSTrustServiceContract contract, DispatchContext dispatchContext, MessageVersion messageVersion, WSTrustResponseSerializer responseSerializer, WSTrustSerializationContext
    serializationContext, AsyncCallback asyncCallback, Object asyncState)
    at Microsoft.IdentityModel.Protocols.WSTrust.WSTrustServiceContract.BeginProcessCore(Message requestMessage, WSTrustRequestSerializer requestSerializer, WSTrustResponseSerializer responseSerializer, String requestAction, String responseAction, String
    trustNamespace, AsyncCallback callback, Object state)
    System.IdentityModel.Tokens.SecurityTokenValidationException: ID4070: The X.509 certificate 'CN=Me, OU=People, O=acme., C=com' chain building
    failed. The certificate that was used has a trust chain that cannot be verified. Replace the certificate or change the certificateValidationMode. 'A certification chain processed correctly, but one of the CA certificates is not trusted by the policy provider.
    at Microsoft.IdentityModel.X509CertificateChain.Build(X509Certificate2 certificate)
    at Microsoft.IdentityModel.Tokens.X509NTAuthChainTrustValidator.Validate(X509Certificate2 certificate)
    at Microsoft.IdentityModel.Tokens.X509SecurityTokenHandler.ValidateToken(SecurityToken token)
    at Microsoft.IdentityModel.Tokens.SecurityTokenElement.GetSubject()
    at Microsoft.IdentityServer.Service.SecurityTokenService.MSISSecurityTokenService.GetOnBehalfOfPrincipal(RequestSecurityToken request, IClaimsPrincipal callerPrincipal)
    thx
    Stef71

    This is perfectly correct on my case I was not adding the root properly you must add the CA and the ADFS as well, which is twice you can see below my results.
    on my case was :
    PS C:\Users\administrator.domain> $root = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2("C:\
    cer\SP2K10\ad0001.cer")
    PS C:\Users\administrator.domain> New-SPTrustedRootAuthority -Name "domain.ad0001" -Certificate $root
    Certificate                 : [Subject]
                                    CN=domain.AD0001CA, DC=domain, DC=com
                                  [Issuer]
                                    CN=domain.AD0001CA, DC=portal, DC=com
                                  [Serial Number]
                                    blablabla
                                  [Not Before]
                                    22/07/2014 11:32:05
                                  [Not After]
                                    22/07/2024 11:42:00
                                  [Thumbprint]
                                    blablabla
    Name                        : domain.ad0001
    TypeName                    : Microsoft.SharePoint.Administration.SPTrustedRootAuthority
    DisplayName                 : domain.ad0001
    Id                          : blablabla
    Status                      : Online
    Parent                      : SPTrustedRootAuthorityManager
    Version                     : 17164
    Properties                  : {}
    Farm                        : SPFarm Name=SharePoint_Config
    UpgradedPersistedProperties : {}
    PS C:\Users\administrator.domain> $cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2("C:\
    cer\SP2K10\ADFS_Signing.cer")
    PS C:\Users\administrator.domain> New-SPTrustedRootAuthority -Name "Token Signing Cert" -Certificate $cert
    Certificate                 : [Subject]
                                    CN=ADFS Signing - adfs.domain
                                  [Issuer]
                                    CN=ADFS Signing - adfs.domain
                                  [Serial Number]
                                    blablabla
                                  [Not Before]
                                    23/07/2014 07:14:03
                                  [Not After]
                                    23/07/2015 07:14:03
                                  [Thumbprint]
                                    blablabla
    Name                        : Token Signing Cert
    TypeName                    : Microsoft.SharePoint.Administration.SPTrustedRootAuthority
    DisplayName                 : Token Signing Cert
    Id                          : blablabla
    Status                      : Online
    Parent                      : SPTrustedRootAuthorityManager
    Version                     : 17184
    Properties                  : {}
    Farm                        : SPFarm Name=SharePoint_Config
    UpgradedPersistedProperties : {}
    PS C:\Users\administrator.PORTAL>

  • A question about a method with generic bounded type parameter

    Hello everybody,
    Sorry, if I ask a question which seems basic, but
    I'm new to generic types. My problem is about a method
    with a bounded type parameter. Consider the following
    situation:
    abstract class A{     }
    class B extends A{     }
    abstract class C
         public abstract <T extends A>  T  someMethod();
    public class Test extends C
         public <T extends A>  T  someMethod()
              return new B();
    }What I want to do inside the method someMethod in the class Test, is to
    return an instance of the class B.
    Normally, I'm supposed to be able to do that, because an instance of
    B is also an instance of A (because B extends A).
    However I cannot compile this program, and here is the error message:
    Test.java:16: incompatible types
    found   : B
    required: T
                    return new B();
                           ^
    1 errorany idea?
    many thanks,

    Hello again,
    First of all, thank you very much for all the answers. After I posted the comment, I worked on the program
    and I understood that in fact, as spoon_ says the only returned value can be null.
    I'm agree that I asked you a very strange (and a bit stupid) question. Actually, during recent months,
    I have been working with cryptography API Core in Java. I understood that there are classes and
    interfaces for defining keys and key factories specification, such as KeySpec (interface) and
    KeyFactorySpi (abstract class). I wanted to have some experience with these classes in order to
    understand them better. So I created a class implementing the interface KeySpec, following by a
    corresponding Key subclass (with some XOR algorithm that I defined myself) and everything was
    compiled (JDK 1.6) and worked perfectly. Except that, when I wanted to implement a factory spi
    for my classes, I saw for the first time this strange method header:
    protected abstract <T extends KeySpec> T engineGetKeySpec
    (Key key, Class<T> keySpec) throws InvalidKeySpecExceptionThat's why yesterday, I gave you a similar example with the classes A, B, ...
    in order to not to open a complicated security discussion but just to explain the ambiguous
    part for me, that is, the use of T generic parameter.
    The abstract class KeyFactorySpi was defined by Sun Microsystem, in order to give to security
    providers, the possibility to implement cryptography services and algorithms according to a given
    RFC (or whatever technical document). The methods in this class are invoked inside the
    KeyFactory class (If you have installed the JDK sources provided by Sun, You can
    verify this, by looking the source code of the KeyFactory class.) So here the T parameter is a
    key specification, that is, a class that implements the interface KeySpec and this class is often
    defined by the provider and not Sun.
    stefan.schulz wrote:
    >
    If you define the method to return some bound T that extends A, you cannot
    return a B, because T would be declared externally at invocation time.
    The definition of T as is does not make sense at all.>
    He is absolutely right about that, but the problem is, as I said, here we are
    talking about the implementation and not the invocation. The implementation is done
    by the provider whereas the invocation is done by Sun in the class KeyFactory.
    So there are completely separated.
    Therefore I wonder, how a provider can finally impelment this method??
    Besides, dannyyates wrote
    >
    Find whoever wrote the signature and shoot them. Then rewrite their code.
    Actually, before you shoot them, ask them what they were trying to achieve that
    is different from my first suggestion!
    >
    As I said, I didn't choose this method header and I'm completely agree
    with your suggestion, the following method header will do the job very well
    protected abstract KeySpec engineGetKeySpec (Key key, KeySpec key_spec)
    throws InvalidKeySpecException and personally I don't see any interest in using a generic bounded parameter T
    in this method header definition.
    Once agin, thanks a lot for the answers.

  • How do you invoke a method with native int array argument?

    Hi,
    Will someone help me to show me a few codes samples on how to invoke a method which has only one argument, an int [] array.
    For exampe:
    public void Method1(int [] intArray) {...};
    Here is some simple code fragment I used:
    Class<?> aClass = Class.forName("Test2");
    Class[] argTypes = new Class[] {int[].class};
    Method method = aClass.getDeclaredMethod("Method_1", argTypes);
    int [] intArray = new int[] {111, 222, 333};
    Object [] args = new Object[1];
    args[0] = Array.newInstance(int.class, intArray);
    method.invoke(aClass, args);I can compile without any error, but when runs, it died in the "invoke" statement with:
    Exception in thread "main" java.lang.IllegalArgumentException: object is not an instance of declaring class
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at Test1.invoke_Method_1(Test1.java:262)
         at Test1.start(Test1.java:33)
         at Test1.main(Test1.java:12)
    Any help is greatly appreciated!
    Jeff

    Sorry, my bad. I was able to invoke static methods and instance methods with all data types except native int, short, double and float, not sure the proper ways to declare them.
    After many frustrating hours, I posted the message for help, but at that time, my mind was so numb that I created a faulted example because I cut and pasted the static method invocation example to test the instance method passing int array argument.
    As your post suggested, "args[0] = intArray;", that works. Thanks!
    You know, I did tried passing the argument like that first, but because I was not declaring the type properly, I ended up messing up the actual passing as well as the instantiation step.
    I will honestly slap my hand three times.
    jml

  • Trying to Imitate the html POST  method with an applet

    I am trying to imitate the POST method with an applet, so that I can eventually send sound from a microphone to a PHP script which will store it in a file on a server. I am starting out by trying to post a simple line of text by making the PHP script think that it is receiving the text within a POST-ed file. The reason I am doing things this way is in part because I am, for the time being, limited to a shared server without any support for servlets or any other server side java.
    The code I am trying is based in part on an old thread found elsewhere in this forum, concerning sending data to a PHP file by imitating the POST method:
    link:
    http://forum.java.sun.com/thread.jspa?threadID=530399&messageID=2603608
    someone named "harmmeijer" provided most of the answers on that thread. If that person is still around hope they take a look at this,also I have some questions to clarify what they said on the other thread..
    My first attempt at code is below. The applet is in a signed jar file and is trying to pass a text line to the PHP script in the same directory and on the same server that the applet came from. It is doing this by sending header information that is supposed to be identical to what an html form would send if it was uploading a .txt file with the line of text within it. The applet displays one button. When you press it, it sucessfully starts up the postsim method (defined at the end), which is supposed to send the info to the PHP script at the server.
    I have two questions:
    1) I know that the PHP script is starting up, because it prints out a few messages depending on what happens. However, the script does not recognize any file coming down the line, so it does not save anyting on the server, and prints out a message saying the no file was uploaded.
    Any idea what might be going wrong? I'm not getting any error messages from the applet. I've tried a few different variations of the 'header' information contained in the line:
    osToServer.writeBytes("--****4353\r\nContent-Disposition: form-data; name=\"testfile\"; filename=\"C:testfile.txt\"\r\nContent-Type: text/plain\r\n");
    The commented out line below it shows one variation (which was given in the thread mentioned above).
    2) You'll notice that I've commented out the two lines having to do with the input line:
    //InputStream isFromServer;
    and
    //isFromServer = uc.getInputStream();
    The reason is that the program crahes whenever I put the latter line in - to the extent that Opera closes down the JVM and then crashes when I tried to exit it.. I must be doing something horribly wrong there! I first tried using isFromServer = new DataInputStream(uc.getInputStream());
    becuase it was consistent with the output stream, but that caused the same problem.
    Here's the code:
    public class AudioUptest1 extends Applet{
    //There are a few spurious things defined in this section, having to do with the fact the microphone data is evenuatly going to be sent. haven't yet insterted code to get input from a microphone.
    AudioFormat audioFormat;
    TargetDataLine targetDataLine;
    SourceDataLine sourceDataLine;
    DataOutputStream osToServer;
    //InputStream isFromServer;
    URLConnection uc;
    final JButton captureBtn = new JButton("Capture");
    final JPanel btnPanel = new JPanel();
    public void init(){
    System.out.println("Started the applet");
    try
    URL url = new URL( "http://www.mywebsite.com/handleapplet.php" );
    uc = url.openConnection();
    //Post multipart data
    uc.setDoOutput(true);
    uc.setDoInput(true);
    uc.setUseCaches(false);
    //set request headers
    uc.setRequestProperty("Connection", "Keep-Alive");
    uc.setRequestProperty("HTTP_REFERER", "http://applet.getcodebase");
    uc.setRequestProperty("Content-Type","multipart/form-data; boundary=****4353");
    osToServer = new DataOutputStream(uc.getOutputStream());
    //isFromServer = uc.getInputStream();
    catch(IOException e)
    System.out.println ("Error etc. etc.");
    return;
    //Start of GUI stuff
    captureBtn.setEnabled(true);
    //Register listeners
    captureBtn.addActionListener(
    new ActionListener(){
    public void actionPerformed(
    ActionEvent e){
    captureBtn.setEnabled(false);
    //Postsim method will send simulated POST to PHP script on server.
    postsim();
    }//end actionPerformed
    }//end ActionListener
    );//end addActionListener()
    add(captureBtn);
    add(btnPanel);
    // getContentPane().setLayout(new FlowLayout());
    // setDefaultCloseOperation(EXIT_ON_CLOSE);
    setSize(250,70);
    setVisible(true);
    }//end of GUI stuff, constructor.
    //These buffers might be made larger.
    byte tempOutBuffer[] = new byte[100];
    byte tempInBuffer[] = new byte[100];
    private void postsim(){
    System.out.println("Got to the postsim method");
    try{
    //******The next four lines are supposed to imitate a POST upload from a form******
    osToServer.writeBytes("--****4353\r\nContent-Disposition: form-data; name=\"testfile\"; filename=\"C:testfile.txt\"\r\nContent-Type: text/plain\r\n");
    //osToServer.writeBytes("Content-Disposition: form-data; name=\"testfile\"; filename=\"C:testfile.txt\"\r\nContent-Type: text/plain\r\n");
    //This is the text that's cupposed to be written into the file.
    osToServer.writeBytes("This is a test file");
    osToServer.writeBytes("--****4353--\r\n\r\n");
    osToServer.flush();
    osToServer.close();
    catch (Exception e) {
    System.out.println(e);
    System.out.println("did not sucessfully connect or write to server");
    System.exit(0);
    }//end catch
    }//end method postsim
    }//end AudioUp.java

    Hi All,
    I was trying to write a signed applet that helps the
    user of the applet to browse the local hard disk and
    select a file from the same. The JFileChooser class
    from Swing is what I used in my applet. The problem
    is with the policy file. I am not able to trace the
    exact way to write a policy file which gives a total
    access to read,write,delete,execute on all the drives
    of the local hard disk.
    I am successful in signing the applets and performing
    operations : read,write,delete & execute on a single
    file but failing to grant permission for the entire
    file.
    Any help would be highly appreciated.Which policy file are you using? there might be more than one policy file.
    also, u have to specify the alias of the signed certificate in the policy file to grant the necessary priviledges to the signed applet.

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

  • Building a method with more than one result data

    Hi, everyone:
    I'm a little shy to ask this question, however, it's been hanging in my mind for so long, so I think I'd rather make a confession on it. You may laugh at me if you want, I'm ready for that, but I more look forward to that someone can really give me the light, or even the link, or some hint....
    For your ease of reading, I give the question first, and my whole story behind:
    When I need a method which can provide more than one result( in other words, multiple outputs), how can I do it in Java? As I know, either you pass and object, or the result of the function is an object will do , for the object contains the datas you want, but that means your needs for those data have to be defined in object format in advance, won't that be inconvinient? Or Java has a better solution for that?
    //And here's the whole story....
    I began my career as a programmer by starting with LabVIEW, it's a graphical programming language made by National Instrument, and it's powerful on DAQ, and industrial field. One of the most important issues on design is to devide your system into multiple functions( in its own term: subVI), I think it's just like applying structured analysis method.
    When we dealing with functions in LabVIEW, a programmer can define his own function with mulitiple inputs and outputs, for example, I can design a function called SumAndDevide, which accepts two input ( two variables to be summed and devided) and gives two results( result of summing and that of deviding).
    The methodology has its power, at least it provide the functional decomposition, and you can compose a suitable solution in certain circumstance even they are not the smallest unit function. And testing is easy. It affects me so large that I look the trail of it when I come to other programming languages. In COBOL( well, that is a VERY old COBOL version ), I was scared to find there is no protection to the inner data on the performed sections, while making a outside subroutine to be called is cubersome and really a hard work. When I came to Delphi, I knew that using the result of a function cannot satisfy me, for it give only one output, even you can define it as variant, but I think it's vague to realize. So I use the difference of called by value and called by reference to handle the problem, that is: a value parameter for the input, and a variable paramter for the output.
    Well, when I came to Java, I am stunned again, now there is no passing by reference mechanism in Java, otherwise you have to pass it as an object, but that means when you need multiple outputs, the output has to be defined in object form in advance. And that will be very inconvinient!! I tried to find some solutions, but I can't. So is there any way that in Java you can define a method with multiple output? or Java handles the problem in totally different way?
    Any comments will be appreciated!!
    Thanks!!
    aQunx from Taiwan

    You missed the most common OO solution - separation of concerns and implementation hiding.
    If you have a function which returns a string, that is one method of the object that provides the service.
    If you have a function which returns a real, that is a different method of the object.
    If both functions require common code, move that into a private method which is called by both. If the method is costly, cache the result.
    eg an aerodynamics properties class, which could be done as a multivalued return of (lift, drag), refactored to independent lift() and drag() methods, which delegate to an interpolate() method, which caches the interpolated value and uses mach, pressureHeight and _alpha to determine whether it should recalculate:  /**
       * Calculates the aerodynamic drag force at a given mach, alpha and pressure height.
      public double drag (final double aMach, final double aPressureHeight, final double aAlpha) {
        interpolate(aMach, aPressureHeight, aAlpha);
        return _drag;
       * Calculates the aerodynamic lift force at a given mach, alpha and pressure height.
      public double lift (final double aMach, final double aPressureHeight, final double aAlpha) {
        interpolate(aMach, aPressureHeight, aAlpha);
        return _lift;
      private void interpolate (final double aMach, final double aPressureHeight, final double aAlpha) {
        if (aMach != _mach) {
          setMach(aMach);
          _pressureHeight = Double.NaN;
        if (aPressureHeight != _pressureHeight) {
          setPressureHeight(aPressureHeight);
          _alpha = Double.NaN;
        if (aAlpha != _alpha) {
          setAlpha(aAlpha);
    ... actual interpolation happens in the private setXXX methods.

  • 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

  • JSR 172: error while invoking methods with the same signature

    Hi
    I am facing a peculiar problem which is not making sense to me. This is what I have done:
    1. Written a simple web service that has two methods: sayHello and sayHellToMe. Both these methods have same signatures. They do not take in any parameter and return a string.
    2. Deployed this web service (document/literal) type on Axis 1.2
    3. Generated the stub classes from the wsdl file using Sun Wireless Toolkit's Stub Generator
    4. I have now written a MIDlet that uses this stub class to invoke both the methods one after the other.
    I enabled SOAPMonitor on Axis and saw the SOAP Request and SOAP Response messages. I observed the following:
    1. In the first method: sayHello - everything works fine (with a few tweaks in the Stub class)
    2. However, while invoking the second method sayHelloToMe, the SOAP Body tag in the SOAP Request does not contain any method name. I checked out the Stub class, the qnames and the types are all correct..
    I also realized that this behavior is seen only when I have methods with the same signature in the web service. Any idea why this might be happening? It seems like a very weird problem.
    Any help in this regard will be greatly appreciated.
    Thanks,
    Arati

    Hi, I'm closing this thread and opening the same in another as the content got pasted in reader un friendly format and i'm unable to change the format.
    Thanks,
    Ravi.

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

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

  • Applet with 2 methods with the same name in ie

    Hi,
    I have a problem with the Java 1.5 plugin for Internet Explorer .
    When my Applet contains 2 methods with the same name but not the same return type, ie does not take the good return type.
    Here is an exemple :
    * Class TestApplet
    package test.applet;
    import java.applet.Applet;
    public class TestApplet extends Applet {
         public void init() {
              System.out.println("init()");
         public void start() {
              System.out.println("start()");
         public String test(String s) {
              System.out.println("test(String) :" + s);
              return s;
         public boolean test(int i) {
              System.out.println("test(int) :" + i);
              return true;
    }I have 2 methods test(), one returns a String and the other a boolean.
    I use the following html code :
    <html>
    <head>
    <script>
    function test() {
         alert(document.DataAccess.test("hello"));
    </script>
    </head>
    <body>
    <applet WIDTH="500" HEIGHT="200" ID="DataAccess" NAME="DataAccess" CODE="test.applet.TestApplet">
    </applet>
    <div onclick="test()">test</div>
    </body>
    </html>
    When I click on "test", the alert show "true" instead of "hello".
    The problem only occurs with a JVM 1.5. It work fine with JVM 1.4.
    Any idea ? Is it a bug ?
    Thanks.

    In your javascript method:
    function test() {
    alert(new String(document.DataAccess.test("hello")));
    MSJVM and SUN jre use different conversion from javaScript objects to Java.
    if you call from javaScript:
    document.getElementById("myApplet").myMethod(22);
    The method in MSJVM should look like this:
    public whatever myMethod(Double d);
    and SUN jre:
    public whatever myMethod(Integer i);
    The best thing to do is this:
    public whatever myMethod(Object o);
                   int col = 0;
                   if (o.getClass().getName().toLowerCase().indexOf("integer") != -1) {
                        col = ((Integer) o).intValue();
                   } else {
                        col = ((Double) o).intValue();
                   }

Maybe you are looking for

  • How to transport Messages between two systems

    Dear Expert, I have a question regarding support message transport. Now I want to transport support messages from one system to another. The source system is Solution Manage 7 EHP1 and target system is something with patch level less than 17. How can

  • Command to compile all installed packages

    hi to all, exist a command to compile all packages are installed in your system ? thanks

  • SAP RFID FAQ

    Hi Guys,    I have thought to have an RFID FAQ's Thread. So that we can add any FAQ's which you want to know or if you know a question and answer which other's might not be knowing to this Thread and keep this thread going.     So that we all can lea

  • HT201210 How do I resolve error 6?

    How do I resolve error 6 on my IPhone 4?

  • Adobe Acrobat 8.1 help with language switching

    We are a diversified company with English and Japanese users.. I am currently testing the Japanese version which allows a user to choose English or Japanese the first time they run Adobe Acrobat. Is there a way to reset the choice, so that the next t