Calling a Method From JSP

Hello People!!!
I'm trying to call a method inside a viewObject from a JSP page using taglibs, but I don't know how to do this.
Anyone can help me to do this call ??
I need to pass a parameter to the method... this parameter is a column value!!
thanks

Are you trying to set a whereclause? If so you can always set the whereclause as an argument to your datasource tag.. An example of this is done in the Online Orders sample app at:
http://otn.oracle.com/sample_code/products/jdev/content.html (see search_results.jsp)
In general you can use the scriptable variable that you define for your BC4J Datasource to access different BC4J methods.
Here's some code snippets showing different ways to access the BC4J Rowset (View Object) or the Application Module..
<jbo:ApplicationModule id="Mypackage3Module" definition="Project3.Mypackage3Module" releasemode="Stateful" />
<jbo:DataSource id="ds" appid="Mypackage3Module" viewobject="EmpView3" rangesize="3"/>
<%
ds.getRowSet().executeQuery();
ds.getRowSet().first();
ds.getRowSet()....(etc)
// etc..
or
ds.getApplicationModule()....(etc)
%>
JSP Codeinsight will pop up your options..
To ensure that Insight will work, make sure you have a closing scriplet marker.. "%>"...
-Chris

Similar Messages

  • Call jpf method from jsp

    Is there anyway to call a method in Controller.jpf from a jsp page? I want to have my jsp page call a method from the jpf controller through an onChange event in the select tag. Otherwise I will have to write a large amount of javascript directly into my jsp page and really defeats the purpose of the MVC architecture. Any help is greatly appreciated. Thanks in advance.

    The jsp might look something like this:
    <netui:form action="DoThisOnChange">
    <!--all other jsp stuff-->
    <netui:select dataSource"" optionsDataSource="" onChange="this.form.submit()"/>
    </netui:form>
    And in JPF declare action named "DoThisOnChange" and write the logic to be done on event "onChange".
    --SJ                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Calling class methods from jsp

    hi - this seems like it should be painfully obvious but I am missing something somewhere and can't seem to get it to work.
    The end result I am looking for is to be able to call a method similar to how I would do it in PHP or ASP.
    To do this I have writte the following class (just as an example) and combpiled it to /WEB-INF/classes/com/example/util/Echo.class:
    package com.example.util;
    class Echo
    public static void main(String[] args)
    System.out.println(args[0]);
    I then have a sample JSP that I attempt to use this in that looks like:
    <%@ page import="com.example.util.Echo" %>
    <%
    RDmail("I'm using my Echo class.");
    %>
    My expectation would be that when I run this page in a browser, I see the text "I'm using my Echo class." printed out on the page. Instead I get the following error:
    An error occurred at line: 1 in the jsp file: /classtest.jsp
    Generated servlet error:
    [javac] Compiling 1 source file
    /var/tomcat4/work/Standalone/localhost/raindance/classtest_jsp.java:47: cannot resolve symbol
    symbol : method Echo (java.lang.String)
    location: class org.apache.jsp.classtest_jsp
    Echo("I'm using my Echo class");
    ^
    1 error
    What am I doing wrong?

    Umm... I'm not entirely sure what you're attempting to do, but it looks like there's some discrepancy between your error message and your code...
    RDmail("I'm using my Echo class."); in your code
    and
    Echo("I'm using my Echo class"); in your error message.
    Is this just a cut/paste error?
    Also, the main() method is only called from a command line, and will not be run when you instantiate your bean in a JSP. If you want to have your String printed out when you create a new object, you should put the print statement in the constructor. Which would then be called when you created a new object..
    Echo e = new Echo("I'm using my Echo class");
    Or, you could create a static method inside Echo.java that prints out the statement.
    Finally, your System.out most likely will not print to your browser, but probably to a standard log, or perhaps a command window.

  • Call static method from jsp expression

    Hi, I'm using adf/bc 10.1.3.4 I'm wanting to call a static method of a class when an af:commandLink is clicked. This action attribute value for this af:commandLink would be an el expression. As an example, let's say I want to call a new static method, named test(), I've added to ADFUtils.
    My af:commandLink looks like this:
    <af:commandLink action="#{ADFUtils.test}" />
    Obviously, this doesn't work. I can describe my actual use case if it would help. For now I'll just say that I don't want to use a managed/backing bean to house this method. How can I create a class to house this method w/o using a managed bean and adding that managed bean reference to the faces-config.xml?? Thanks, James

    thanks for the interest john. i'll explain what it is i'm trying to do. I have two web applications, appA and appB, both running in the same app server instance. The apps are related in the sense that once the user logs in thru an sso mechanism, they can 'bounce' back and forth between applications. Not sure if that info is relevant, but I wanted to include it anyhow.
    We've created a common banner/header jsp that we include in every page of appA and appB. Included in that header jsp is a logout link (af:commandLink), which will need to execute some code when clicked. Here is where the dilemma starts. We don't really want to have to write the code for the logout in a managed/backing bean because although both applications can use that same bean (we have it set up in the repository so that when a checkout/update is done on either appA or appB, each app, utilizing an svn external rule, would get both the banner jsp and the logout code that goes with it), making good use of the reusability concept, we would also have to add a reference to that backing/managed bean in the faces-config.xml of each application in order for it to be instantiated and used by each app. I was hoping to implement a solution which wouldn't require the developer to have to do any 'setup' on an application by application basis to use the header jsp and the code behind the Logout link. I've described a simple scenario, but in reality we'll have multiple applications, which means multiple places (faces-config.xml) where we'd need to add a reference to the managed bean which contains the logout code. It wouldn't be the end of the world for us if we ended up doing it this way, but I just have a feeling like there may be a better way to implement this so that each application's faces-config doesn't need to be touched. Hope my explanation is clear. thanks for any help you can offer.
    Edited by: kcjim on Feb 25, 2009 8:21 AM
    Edited by: kcjim on Feb 25, 2009 8:22 AM

  • Calling method from jsp file

    Hi
    is it possible to call any method with in the class except handle method from jsp file?

    You can call , but it would not be a good design approach.A droplet can do the same task for you.
    otherwise :
    eg :
    <%@ page import="com.mypackage.MyClass"%>
    for Static access :
    <%
    String test= MyClass.myMethod();
    %>
    for normal classes :
    <%
    MyClass object = new MyClass();
    String test= object .myMethod();
    %>
    http://stackoverflow.com/questions/10918526/call-java-method-in-jsp-file
    http://www.javaworld.com/javaworld/jw-05-2003/jw-0523-calltag.html?page=2
    ```
    Praveer
    Edited by: Praveer Rai on Mar 26, 2013 5:08 PM

  • Calling Java Methods from Stored Procedures

    Can I call Java Methods from Oracle Stored Procedures? I have a Java framework that logs events and would like to reuse it for logging events that occur in stored procedures.
    null

    You need to publish java class methods to plsql.
    Attached below is some information.
    Although both PL/SQL modules and Java classes are stored in the database
    and are managed by many of the same mechanisms, each of them resides in
    its own namespace. Therefore, Java methods are not accessible from SQL
    and PL/SQL by default. In order to expose Java methods to the SQL and
    PL/SQL engines, first publish that Java method to the SQL namespace using
    a 'Call Spec'.
    Note: A 'Call Spec' does not create an additional layer of
    execution so there is no performance penalty incurred.
    A 'Call Spec' is simply a syntactical mechanism used to
    make a method known in the SQL namespace.
    The SQL name established by the 'Call Spec' can be top-level or packaged.
    The syntax differs only slightly and is consistent with that used for
    PL/SQL procedures and packages. For more information on the exact
    syntax, see the references listed in 'Related Topics'.
    In general, a top-level procedure 'Call Spec' takes the form:
    CREATE OR REPLACE PROCEDURE procname ( pname mode ptype, ... )
    AS LANGUAGE JAVA NAME 'javaname ( javatype, ... )';
    Where: procname is the SQL name you wish to publish
    pname is the name for a parameter to procname
    mode is the parameter mode (i.e. IN, OUT, IN OUT)
    ptype is a valid SQL type (e.g. NUMBER, CHAR, etc.)
    javaname is the fully qualified name of the Java method
    javatype is a Java type for the corresponding parameter
    Likewise, a top-level function 'Call Spec' takes the form:
    CREATE OR REPLACE FUNCTION fname ( pname mode ptype, ... ) RETURN rtype
    AS LANGUAGE JAVA NAME 'javaname ( javatype, ... ) return javatype';
    Where: fname is the SQL name you wish to publish
    rtype is the SQL return type of the function
    Note: Within the NAME clause, everything within quotes is case
    sensitive. For example, if the keyword 'return' is in all
    CAPS, this Call Spec will not compile.
    Other optional parts of this syntax have been omitted here for simplicity.
    Additional examples in subsequent sections illustrate some of these options.
    eg
    CREATE PROCEDURE MyProc (rowcnt IN NUMBER, numrows OUT NUMBER)
    AS LANGUAGE JAVA NAME 'MyClass.MyMethod(int, int[])';
    There are several important things to note here:
    1.) The 'Call Spec' for a JSP must be created in the same schema as the
    corresponding Java class that implements that method.
    2.) IN parameters are passed by value. This is the only parameter mode
    available in Java. OUT parameters, therefore, must be passed as single
    element arrays in order to emulate pass by reference.
    3.) Parameter names do not need to match, but the number and types of
    the parameters must match (with just one exception - see item 5 below).
    Oracle 8i supports conversions between an assortment of SQL and Java.
    See the references listed in 'Related Topics' for additional information.
    4.) Primitive types (e.g. int, float, etc.) are not required to be fully
    qualified with any package name. However, standard Java object types
    (e.g. String, Integer, etc.) as well as any user defined object types
    (e.g. like those generated by JPublisher) must be prefixed with a
    corresponding package name (e.g. java.lang) if applicable.
    5.) The 'main' method which takes a single String[] parameter can be
    mapped to any PL/SQL procedure or function which takes some number
    of VARCHAR2 or CHAR type IN parameters. For example, the java method:
    public static void main ( String[] args ) { ... }
    can be mapped to each of the following:
    PROCEDURE MyProc2 ( arg1 IN CHAR ) ...
    PROCEDURE MyProc3 ( arg1 IN CHAR, arg2 IN VARCHAR2 ) ...
    PROCEDURE MyProc4 ( arg1 IN VARCHAR2, arg2 IN VARCHAR2 ) ...
    and so forth. Parameters map to the corresponding element of the String
    array (e.g. arg1 -> args[0], arg2 -> args[1], etc.).
    null

  • Operation not found error while calling AM methods from managed bean

    Hi,
    operation not found error while calling AM methods from managed bean.
    written a method with two parameters in AM.
    exposed the method in AM client interface
    in the page bindings added the method in method action ..left empty in the value fields of the parameters.
    calling the method from managed bean like below
    String userNameVal = (String)userName.getValue();
    String passwordVal = (String)password.getValue();
    OperationBinding operationBinding =
    ADFUtils.findOperation("verifyLogin");
    operationBinding.getParamsMap().put("userName",userNameVal);
    operationBinding.getParamsMap().put("password",passwordVal);
    operationBinding.execute();
    i am getting operation verifyLogin not found error.Please suggest me something to do.
    Thanks
    Satya

    Hi vlsn,
    Can you try with the below code
    // in your backing bean
    OperationBinding operation = bindings.getOperationBinding("verifyLogin");
    //Put your both parameters here
    operation.getParamsMap().put("parameter_name1", parameterValue1);
    operation.getParamsMap().put("parameter_name2", parameterValue2);
    operation.execute();
    if (operation.getResult() != null) {
    Boolean result = (Boolean) operation.getResult();
    and share the result.
    regards,
    Rajan

  • Calling a method from a super class

    Hello, I'm trying to write a program that will call a method from a super class. This program is the test program, so should i include extends in the class declaration? Also, what code is needed for the call? Just to make things clear the program includes three different types of object classes and one abstract superclass and the test program which is what im having problems with. I try to use the test program to calculate somthing for each of them using the abstract method in the superclass, but its overridden for each of the three object classes. Now to call this function what syntax should I include? the function returns a double. Thanks.

    Well, this sort of depends on how the methods are overridden.
    public class SuperFoo {
      public void foo() {
         //do something;
      public void bar(){
         //do something
    public class SubFoo extends SuperFoo {
       public void foo() {
          //do something different that overrides foo()
       public void baz() {
          bar(); //calls superclass method
          foo(); //calls method in this (sub) class
          super.foo(); //calls method in superclass
    }However, if you have a superclass with an abstract method, then all the subclasses implement that same method with a relevant implementation. Since the parent method is abstract, you can't make a call to it (it contains no implementation, right?).

  • Need help calling a method from an immutable class

    I'm having difficulties in calling a method from my class called Cabin to my main. Here's the code in my main              if(this is where i want my method hasKitchen() from my Cabin class)
                        System.out.println("There is a kitchen.");
                   else
                        System.out.println("There is not a kitchen.");
                   }and here's my method from my Cabin class:public boolean hasKitchen()
         return kitchen;
    }

    You should first have an instance of Cabin created by using
       Cabin c = ....
       if (c.hasKitchen()) {
         System.out.println("There is a kitchen.");
       } else {
            System.out.println("There is not a kitchen.");
       }

  • Calling a method from another file

    This is pretty basic stuff but i can't seem to get it right. I am calling a method from another file. The other file IS located in the same folder BUT when i compile i get errors
    "cannot find symbol" <===referring to limit and sieve i believe.
    The method name is "sieve" the file name is "PrimeSieve2008" and "limit" is the variable in brackets in the real method.
         public static void main (String [] args) {
    final int [] PRIMES;
    int sieve = PrimeSieve2008.sieve(limit);
         PRIMES = sieve(getValidInt());
              for (int j = 0; j<PRIMES.length; j++) {
                   System.out.println("Prime[" + j + "] = " + PRIMES[j]);
    Is "int sieve = PrimeSieve2008.sieve(limit)" the wrong way to call a file?
    Thanks a million,
    Alex
    Edited by: Simplistic2099 on Apr 3, 2008 7:47 PM
    Edited by: Simplistic2099 on Apr 3, 2008 7:49 PM

    Simplistic2099 wrote:
    the other method runs fine:
    "public static int[] sieve(final int limit){
    int candidate; // possible prime
    int count; // no. of primes found
    boolean[] mayBePrime = new boolean[limit+1];
    // remaining possibilities
    final int[] PRIMES; // array to return
    // initialize mayBePrime
    for ( int j = 0 ; j <= limit ; j++ ) {
    mayBePrime[j] = true;
    mayBePrime[0] = mayBePrime[1] = false;
    // apply sieve, and count primes
    candidate = 2;
    count = 0;
    while ( candidate <= limit ) {
    if ( mayBePrime[candidate] ) {
    count++;
    for ( int j = 2 * candidate ; j <= limit ; j += candidate ) {
    mayBePrime[j] = false;
    } // end for
    } // end if
    candidate++;
    } // end while
    // fill up new array with the primes found
    PRIMES = new int[count];
    count = 0;
    for (int j = 2 ; j <= limit ; j++ ) {
    if ( mayBePrime[j] ) {
    PRIMES[count] = j;
    count++;
    } // end if
    } // for
    return PRIMES;
    } // sieve
    I really am clueless here.in this one you are passing in limit.
    in the other one you are getting limit from somewhere outside of main.

  • Calling a method from another class... that requires variables?

    I'm calling a method from another class to change the date (its a date object) in another class.
    I keep getting the error 'setDate(int,int,int) in Date cannot be applied to ()'
    My code is:
    public int changeDate()
         cycleDate.setDate();
    }I'm guessing I need to pass 3 parameters (day, month, year), but I'm not sure how! I have tried, but then I get errors such as ')' expected?
    Any ideas! :D

    f1d wrote:
    I'm calling a method from another class to change the date (its a date object) in another class.
    I keep getting the error 'setDate(int,int,int) in Date cannot be applied to ()'
    My code is:
    public int changeDate()
    cycleDate.setDate();
    }I'm guessing I need to pass 3 parameters (day, month, year), seems that way from the error you posted
    but I'm not sure how!
    setDate(16, 6, 2008);
    I have tried, but then I get errors such as ')' expected?
    Any ideas! :Dyou need to post your code if you're getting specific errors like that.
    but typically ')' expected means just that, you have too many or not enough parenthesis (or in the wrong place, etc.)
    i.e. syntax error

  • Help on Calling a method from another class

    how can i call a method from another class.
    Class A has 3 methods
    i just want to call only one of these 3 methods into my another class.
    How can I do that.

    When i am trying this
    A a=new A;
    Its calling all the methods from class A. I just want
    to call a specfic method.How can it be done?When i am trying this
    A a=new A();
    Its calling all the methods from class A. I just want to call a specfic method.How can it be done?

  • Calling a method from another class or accessing a component from another

    Hi all
    im trying to make a find/replace dialog box
    my main application form has a jtextpane and when i open up the find and replace dialog box it has two textboxes (find and replace)
    now i have the code to do the finding on my jtextpane but how do i call that code to do the find method?
    I have tried having the code in my main application class but then how do i call that method from my dialog box class?
    ive also tried having the code in my dialog box class, but then how to i tell it to work on my jtextpane which is in my main ap class?

    well if someone had been nice enough to provide me
    with a tutorial i wouldnt have gotten into this
    muddle, no need to be rude is there!I'm not rude. And you also wouldn't have gotten into the muddle if you searched yourself. This site provides many very good tutorials about all kinds of stuff.
    http://java.sun.com/docs/books/tutorial/java/javaOO/classes.htmlAmong other things, it mentions that "static" defines everything that belongs to a class, as opposed to an object.

  • Calling web service from JSP

    Can anyone help??
    I'm trying to call a webservice from within a JSP and i havent a clue how its done,
    i have my IF and Impl and Client Coded and my stubs generated and service deployed and running, but i cannot figure out how to call the service from my JSP web-app.
    Any help appreciated!

    Hi ,
    Its easy to call a WS from jsp what you can do is this. Think in manner that u will be keeping the client classes on a particular container, then in same container you can refrence the classes and can invoke service through a jsp..this works in my case.. it depends what kind of client do u want to create may be static or proxy or DII

  • EJB 3.1 @Asynchronous and calling other methods from within

    Hey all,
    I am helping a friend set up a test framework, and I've turned him on to using JEE6 for the task. I am decently familiar with entity beans, session beans, and such. One of the new features is @Asynchronous, allowing a method to be ran on a separate thread. The test framework generally needs to spawn potentially 1000's of threads to simulate multiple users at once. Originally I was doing this using the Executor classes, but I've since learned that for some reason, spawning your own threads within a JEE container is "not allowed" or bad to do. I honestly don't quite know why this is.. from what I've read the main concern is that the container maintains threads and your own threads could mess up the container somehow. I can only guess that this might be possible if your threads use the container services in some way.. but if anyone could enlighten me on the details as to why this is bad, that would be great.
    None the less, EJB 3.1 adds the async capability and I am now looking to use this. From my servlet I use @EJB to access the session bean, and call an async method. My servlet returns right away as it should. From the async method I do some work and using an entity bean store results, so I don't need to return a Future object. In fact, my ejb then makes an HttpClient call to another servlet to notify it that the result is ready.
    My main question though, is if it's ok to call other methods from the async method that are not declared @Asynchronous. I presume it is ok, as the @Asynchronous just enables the container to spawn a thread to execute that method in. But I can't dig up any limitations on the code within an async method.. whether or not it has restrictions on the container services, is there anything wrong with using HttpClient to make a request from the method.. and making calls to helper methods within the bean that are not async.
    Thanks.

    851827 wrote:
    Hey all,.. from what I've read the main concern is that the container maintains threads and your own threads could mess up the container somehow. I can only guess that this might be possible if your threads use the container services in some way.. but if anyone could enlighten me on the details as to why this is bad, that would be great.
    Yes since the EE spec delegated thread management to conatiners, the container might assume that some info is available in the thread context that you may not have made available to your threads.
    Also threading is a technical implementation detail and the drive with the EE spec is that you should concentrate on business requirements and let the container do the plumbing part.
    If you were managing your own threads spawned from EJBs, you'd have to be managing your EJBs' lifecycle as well. This would just add to more plumbing code by the developer and typically requires writting platform specific routines which the containers already do anyway.
    >
    None the less, EJB 3.1 adds the async capability and I am now looking to use this. From my servlet I use @EJB to access the session bean, and call an async method. My servlet returns right away as it should. From the async method I do some work and using an entity bean store results, so I don't need to return a Future object. In fact, my ejb then makes an HttpClient call to another servlet to notify it that the result is ready.
    My main question though, is if it's ok to call other methods from the async method that are not declared @Asynchronous. I presume it is ok, as the @Asynchronous just enables the container to spawn a thread to execute that method in. But I can't dig up any limitations on the code within an async method.. whether or not it has restrictions on the container services, is there anything wrong with using HttpClient to make a request from the method.. and making calls to helper methods within the bean that are not async.
    Thanks.If you want to be asynchronous without caring about a return value then just use MDBs.
    The async methods have no restrictions on container services and there is nothing wrong with calling other non async methods. Once the async method is reached those annotations don't matter anyway (unless if you call thhose methods from a new reference of the EJB that you look up) as they only make sense in a client context.
    Why do you need to make the call to the servlet from the EJB? Makes it difficult to know who is the client here. Better use the Future objects and let the initial caller delegate to the other client components as needed.

Maybe you are looking for

  • Can two apple IDs share the same library?

    Mac newbie here needs some advice... I just got a new iMac and have created separate accounts for my husband and me on it.  We used to share an apple ID for music, but now I'd like for us to have our own apple IDs especially with the iCloud capabilit

  • How can I sort my imported photo album on the iPhone?

    I would like to sort the imported photos so that the pictures are in the same order as in Photoshop Elements on the PC. Previous to iPhone 4 the sorting was preserved. Now I seem to just have a 'pile' of pictures. Help!

  • CORRECT SOLUTION FOR THE APPSTORE PROBLEM

    CORRECT SOLUTION (by AppleTeam) 1- Uninstall the old version of itunes you have (or just uninstall iTunes if you are already running 10.4.0.80 2- Uninstall Quicktime also 3- Uninstall Apple software update 4- Uninstall Apple mobile device support 5-

  • TAX CONDITION FUNCTIONAL MODULE

    CALL FUNCTION 'FI_TAX_GET_CONDITION' HOW CAN I USE THIS?

  • My new iPod cannot download apps from the app shop

    My iPod using iOS 6.01 can access the app shop but after clicking install, the app label appears in the iPod screen and the word waiting appears. The download wheel appears for a split second and then disappear. The waiting below the app icon continu