Executing JavaBean method

Hi Guys,
I am trying to set parameters from a JSP file to a JavaBean to cause execution to a method which would take the parameter value to execute SQL insert;
Doing something like this;
JSP file
1. JSP setProperty values passing values to JavaBean
JavaBean
1.Recieves parameter in Setter methods
2. JavaBean passes values back to JSP using getter Methods
3. A method uses the parameter values recieved from JSP to execute insert.
The problem is, i can pass the values to the Setters and Getter methods, but the method to run the sql insert won't execute.
Do anyone know how to make sure the JSP file cause execution to the method?
The bean looks like this;
public class JavaBean{
  private String a;
  private String b;
public void setA(String a){
this.a = a;
  public void setB(String b){
  this.b = b;
private void InsertMethod(){
try{
  //INSERT TO Table Values (a and b)
}catch(Exception e){
e.printStack();
}Help guys!

doGetOrDoPost() {
    bean.doSomething();
}

Similar Messages

  • How to pass a javascript variable to a javabean method

    Hi
    I need to pass a String from a Javascript argument to a javabean method. localUrl will be instantiated with a string not from any form item(option box, textbox, etc) so cannot use
    String param = request.getParameter("XXX").
    My code below does not work as localUrl is not seen by javaBean and returns a null.
    function ShowWaitDisplay(localUrl)
    var Description = <%=RandomFeeds.getDescription(localUrl)%>;
    //Do something with the string Description
    Thanks
    Andrew

    Since, java bean code will be executed on the server side and java script executes on client side, by the time your javascript variable created, the bean code is already been executed.

  • How can I execute a method on a specified time?

    How can I execute a method on a specified time such as method1() will be executed on 1:00 p.m and the method2() will be executed in 1:00 a.m?

    BilgeTonyukuk99 wrote:
    How can I execute a method on a specified time such as method1() will be executed on 1:00 p.m and the method2() will be executed in 1:00 a.m?As a simple example, take a look at http://www.javapractices.com/topic/TopicAction.do?Id=54.
    As an alternative (and looks like better approach), you could use the ScheduledThreadPoolExecutor.

  • Authorization to execute a method of BO

    Hello,
    The workitem received by an agent goes into error status when executed due to the reason that the user is not authorized to execute the method of the business object. Please let me know the role or the authorization to be given to the user to execute the workitem. The method is a custom one in a custom BO.
    Thanks,
    Samson

    Hi Samson,
    To rectify this issue you need to get access to the authorization object to execute the BO method.
    To do go, execute the method and on getting the error, go to t-code SU53.
    There you would find an authorization error message. Take a screenshot of this error and send to your basis team and ask them to provide you toe desired authorizations.
    Hope this helps!
    Regards,
    Saumya

  • Very simple question: Call JavaBean method on page load?

    Someone clicks on a URL that contains parameters like: http://server/page.jsf?param=b
    How do I trigger a JavaBean method to run during page load? I see many JSF examples where JavaBean methods get called during form clicks and that works great but here I want to run code on page load.
    This must be really simple; sorry I'm new to this technology.
    Must I use <% ... %> syntax or can I use actual JSF tags or configuration to accomplish this?
    Thanks very much in advance!

    Putting a lot of logic in getter( ) function is not the best idea considering that getter( ) could be called all over the place. Using constructor for same purpose is also a bad idea especially with request scope beans. This could also happen many times at different stages. You are right, having a page load concept could be useful. Unfortunately JSF framework does not support. You could architect around it in case desperate. Or if using JSF implementation of certain vendors like IBM, you can take advantage of their implementation that was extended to support pageLoad and postBack events (similar to .NET).
    Many postings on this forum dealt with topic. Feel free to review like this one:
    http://forum.java.sun.com/thread.jspa?forumID=427&threadID=541382

  • 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

  • Time taken to to execute a method

    Hi,
    I have a method which reads a large file. Is it possible to get the time which needs to execute this method and to get elapsed time while reading the file.
    Thanks a lot,
    Chamal.

    Example:
    private long time; // me love you
    public static void main(String[] mufflewumps)
        startTime();
        new someClass().someLongMethod();
        showElapsedTime();
    private void startTime()
        time = System.currentTimeMillis();
    private void showElapsedTime()
        System.out.println("someLongMethod() elapsed time: " + (System.currentTimeMillis - time));

  • Execute mbean methods in a separate dedicated thread.

    Hi all,
    I have an MBean and I want that all its methods be executed in swing thread. [Common swing confinement rules].
    Is there a way to do this by jmx rulebook?
    One way i though of was to use a proxy class with an inocationhandler which executes the method in the swing thread using SwingUtilities.Invokelater().
    Is there any other cleaner way?
    Thanks,

    The approach you mention looks good. An alternative is that if your MBean is a DynamicMBean then you can simply wrap it in an implementation of the DynamicMBean interface that forwards each of the five methods (excluding getMBeanInfo()) of the interface to the wrapped object, but on the Swing EDT. To avoid hassle with checked exceptions I'd be inclined to use an InvocationHandler for that too. Something like this:
    public class EDTInvocationHandler implements InvocationHandler {
        private final Object wrapped;
        public EDTInvocationHandler(Object wrapped) {
            this.wrapped = wrapped;
        public Object invoke(Object proxy, final Method m, final Object[] args) throws Throwable {
            if (m.getName().equals("getMBeanInfo"))
                return m.invoke(wrapped, args);
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    try {
                        return m.invoke(args);
                   } catch (InvocationTargetException e) {
                       ...log e.getCause()...
                   } catch (Exception e) {
                       ...log e...
        public static DynamicMBean edtDynamicMBean(DynamicMBean mbean) {
            return Proxy.newProxyInstance(
                DynamicMBean.class, DynamicMBean.class.getClassLoader(),
                new EDTInvocationHandler(mbean));
    }Depending on what you want to achieve, it might be better to use invokeAndWait, which would mean you could propagate exceptions to the caller.
    If your MBeans are Standard MBeans (or MXBeans) then you can make them into Dynamic MBeans using javax.management.StandardMBean.
    Regards,
    Éamonn McManus -- JMX Spec Lead -- [http://weblogs.java.net/blog/emcmanus]

  • How to execute the method of a class loaded

    Hi,
    I have to execute the method of com.common.helper.EANCRatingHelper" + version
    version may be 1,2, etc
    if version = 1 the class is com.common.helper.EANCRatingHelper1;
    Iam able to load the class using following code.But iam unable to execute the method of the above class
    Can anybody help me how to execute the method of the class loaded.
    Following is the code
    String version = getHelperClassVersion(requestDate);
    String helperClass = "com.redroller.common.carriers.eanc.helper.EANCRatingHelper" + version;
    Class eancRatingHelper = Class.forName(helperClass);
    eancRatingHelper.newInstance();
    eancRatingHelper.saveRating(); This is not executing throwing an error no method.
    Thanks

    eancRatingHelper.newInstance();Ok, that creates an instance, but you just threw it away. You need to save the return of that.
    Object helper = eancRatingHelper.newInstance();
    eancRatingHelper.saveRating(); This is not executing throwing an error no method.Of course. eancRatingHelper is a Class object, not an instance of your EANCRatingHelper object. The "helper" object I created above is (though it is only of type "Object" right now) -- you have to cast it to the desired class, and then call the method on that.
    Hopefully EANCRatingHelper1 and 2 share a common interface, or you're up the creek.

  • Client Proxy--unable to edit Execute Asynchronous method !!!!

    Hi All,
    With Reference to the blog stated below
    /people/sravya.talanki2/blog/2006/07/28/smarter-approach-for-coding-abap-proxies
    I tried to write code inside the Execute Asynchronous method. But I was unable to edit the method and it comes as can not edit Proxy Objects. Is there any steps to do to make edit option available for this method.
    Regards,
    Sundar.

    Hi,
    you never write code in client proxies in the generated method
    you can only do it for server proxies
    if you want to use the client proxy you need to call it from your own
    report (or function module)
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

  • Error when I am executing any method in shopping cart

    Dear All ,
    I am getting following error when I am executing any method in shopping cart.
    *"No data found for contact person 0000000244 . Inform system administration . "*
    Please Can you help me with this error .

    Your error states:
    !syParameterNotFound,dDocTitle
    Can you confirm that your profile includes all required data, specifically, the dDocTitle? Fix this issue, then re-check your logs. if there are other missing required parameters, fix each one.
    Eventually, you should have a successful check-in.
    Hope this helps,
    -ryan

  • Add a Data Action to Execute a Method - Problem

    Hi,
    I'm working with JDeveloper 10.1.3 - JSP,Struts and ADF BC.
    I have a method that retruns 2 values (audit(Number,Number)) and exposed the Service Metod, but now I need to add a Data Action to Execute that method.
    I already add an Data Action icon to my Page Flow Diagram but what do I need to do next?
    Can anyone help me? Any ideias?
    Thanks,
    Micaela

    Hi Shay,
    I have one problem because how can I create a JSP Page to display Method Results in JDeveloper10.1.3???
    I already created another page and tried to Drag and Drop my Method from Data Control Palette, but I only have the choice to create a button and I would like to see the result.
    Adding a c:out tag to the JSP page.
    Can you help me with this problem??
    Thanks,
    Micaela

  • How to execute a method on mouse move event on an Image

    Hi All,
    I want to execute a method on mouse move event or mouse click event to an image.
    how can i achieve this?
    TIA,
    Vishal

    I am not sure if commandImageLink or goImageLink solve your requirement.
    But as a workaround you can use set of ClientListener and ServerListener with af:image to achieve what you need.
    using then you can capture client event and convert that into server event which you can use to call a bean method.
    Inside this bean you can call a web service or method binding.
    My first link in previous post shows that very well....
    OR
    http://naive-amseth.blogspot.com/2011/02/calling-methodbindingwebservice-on.html
    Amit
    Edited by: amseth on Feb 15, 2011 12:25 AM

  • Cancel WorkItem after execute a Method

    Hi all,
    Is there a way to cancel a workitem after executing a method?
    I put this method at the tab METHODS in the activity USER DECISION, but when the method is executed before the workitem, i need this closed.
    It´s because i am using a worklist at the PORTAL, and then what I need is to show the workitem at the UWL and then when the user click on the link to the WI, execute the METHOD (this method opens a webpage made with webdynpro).
    Best Regards,
    Ricardo

    I think you want to complete the workitem , once the workitem is executed from the UWL right?
    if this is the case as you said that you are using a Decision step which will open a webdynpro applicaiton once it is executed, then instead of using the methods tab, I suggest you to modify from the application side
    1. If the end user clicks on the Approve button or reject button UNder the actions of these button, call the standard SAP fm SAP_WAPI_DECISION_COMPLETE to which you have to pass the currently executed workitem ID and Decision for approve as 0001 and for reject 0002.
    this is more suitable and simple way of completing the worktem.

  • Execute some method once an effect has been played

    Hi everybody, I want to execute a method after the effect i have played is finished. is there any property in AnimationProperty tag to acheive it.
    In the component i have pasted below, getting data from xml file and using repeater populate those data in Hbox then it moves the horizontal scroll position of HBox using animation property. once animation property has been played, it has to execute some method. how can we do it ?
    the next question is
    i want to play animation propery infinite times and i have done it with the help of repeatCount but it takes some delay in between. how can it play infinite imes without any delay in between.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="getXML.send(),slide(event)" >
    <mx:Script>
            <![CDATA[
                import mx.containers.Canvas;
                import mx.rpc.events.FaultEvent;
                import mx.rpc.events.ResultEvent;
                import mx.effects.easing.*;
                import mx.controls.*;
                import mx.collections.*;
                [Bindable] public static var refThumb : Thumbnail;
                [Bindable] public var xmlData : XMLListCollection = new XMLListCollection();
                [Bindable] public var xml :XMLList;
                public function resultHandler(event :ResultEvent) : void
                    xml = event.result.product as XMLList;
                public function faultHandler(event :FaultEvent):void
            public function slide(event :Event):void{
               ap.play();
        ]]>
    </mx:Script >
        <mx:AnimateProperty id="ap" effectEnd="{Web.refWeb.nextSlider()}" repeatCount="0" property="horizontalScrollPosition" fromValue="0" target="{can}" toValue="7200" duration="72000" startDelay="0"/>
        <mx:HTTPService id="getXML" showBusyCursor="true" url="catalog.xml" resultFormat="e4x" result="resultHandler(event)" fault="faultHandler(event)" />
        <mx:HBox paddingTop="20" id="can" width="600" height="200" backgroundColor="white" horizontalScrollPolicy="off" verticalScrollPolicy="off" backgroundAlpha="0.2"  >
        <mx:Repeater id="rep" dataProvider="{xml}" >
            <mx:VBox id="comp" horizontalAlign="center" horizontalGap="200" width="200" height="200" verticalScrollPolicy="off" horizontalScrollPolicy="off">
                             <mx:Image source="{rep.currentItem.image}" width="150" height="100" maintainAspectRatio="false" />
                             <mx:Text text="{rep.currentItem.name}" fontWeight="bold" />
                             <mx:Text text="{'$ '+ rep.currentItem.price}" fontWeight="bold" />
                             <mx:LinkButton label="Add cart" color="blue" />
             </mx:VBox>
        </mx:Repeater>
        </mx:HBox>
    </mx:VBox>

    you have posted a VBox component code so it will be the part of your parent Application are you injecting data into this component from the main application ? and your
    httpService requires catalog.xml so you need to attach that file so i can run on my side successfully . instead of doing this you can tell the problem you are having so i can guide you on that
    regards,
           ATIF.

Maybe you are looking for