How to pass parameter to the method in EJB session bean from Managed Bean

Hi,
I need some guidance in accessing the EJB session bean methods from one of my backing Bean. I use EJB 3.0 Entity Beans and EJB Session Beans. I have to get value from my page and pass it thro the backing bean to the respective EJB session bean. I have no clue of how to do this,
When i click a command link on the page, in its backing bean click method, i am able to get a value and store in a variable under its click action. But from there i am not knowing of how to pass it as a variable to the EJB session bean and hence execute the query(this is where we have to pass the variable as a parameter in its where clause) in the entity bean.
I wanna know how to make a call to the EJB session bean and from there execute the Enitity bean.
Guide me regarding this....
Thanks
ri

Unfortunately dependency injection doesn't work for jsf backing beans, so you have to use a normal jndi lookup to find your session bean. The following example shows you how to find a session bean and call a method:
public void commandButton_actionListener(ActionEvent actionEvent) {
Context ctx;
try {
ctx = new InitialContext();
helloWorldEjb = (HelloWorldEJB)ctx.lookup("HelloWorldEJB");
hello = helloWorldEjb.sayHello(name);
System.out.println(hello);
} catch (NamingException e) {
e.printStackTrace();
}

Similar Messages

  • How to pass parameter onclick of a command link created in a managed bean

    Hi,
    I created a command link in a managed bean using RichCommandLink . I want to pass a parameter on click of the command link like we do using <f:attribute> on the jspx. As i have created a command link using the bean hence i want to pass it programmatically to another method . How should i pass the parameter via the command link. Please help..

    Hi,
    can you please elaborate more on this.
    i am not getting what you are trying to tell.
    following is my actual code in java bean : :
    RichCommandLink remove= new RichCommandLink();
    remove.setId("E"+(rowID-1));
    remove.setText("Remove");
    FacesContext context = FacesContext.getCurrentInstance();
    MethodExpression actionListener = context.getApplication().getExpressionFactory().createMethodExpression(context.getELContext(), "#{viewScope.test.onRemove}", null, new Class[] {ActionEvent.class});
    remove.addActionListener(new MethodExpressionActionListener(actionListener));
    childrenOfGroupLayout.add(remove);
    Here i have created RichCommandLink in Bean, in this i want to add the <f:attribute>
    how to add this in my current component.
    can you give some example..
    please help..

  • How to pass parameter to the Query String of the Named Queries'SQL

    Firstly to say sorry,I'm a beginner and my English is very little.
    Now I want to know
    How to pass parameter to the Query String of the Named Queries'SQL in the Map editor.
    Thanks.

    benzi,
    Not sure if this is on target for your question, but see #5 in the link below for some web screencasts that show how to pass an input text form field value to the bind variable of a view object. If you're looking for something different, maybe provide some more details such as what you are trying to accomplish and what technology stack you are using - for example, ADF BC, JSF, etc.
    http://radio.weblogs.com/0118231/stories/2005/06/24/jdeveloperAdfScreencasts.html
    Also see section 5.9 and chapter 18 in the developer's guide.
    thanks

  • How to pass parameter to action methods

    Hi,
    I have a button.  Enter action method is associated with this.  In the Enter action method, I have added a parameter named param1.  When the button is clicked, this method is called automatically.  But how do I pass parameters to this method, which I have declared ?
    Regards,
    Suresh.

    Hi Suresh Babu,
    The associated method (Event Handler) is triggered by default and cannot pass the values. Instead, use the context node or attributes to set/get the values in the event handler method.
    Regards,
    Sravan Varagani

  • How to pass parameter to the custom class based on CL_RSR_WWW_MODIFY_TABLE

    Hello
    I created custom class based on CL_RSR_WWW_MODIFY_TABLE in order to modify web template.
    I would like to pass parameter to this class. How is it possible?
    HUGE thanks!

    Hello ,
              Various methods will be given for the class like CAPTION_CELL CHARACTERISTIC_CELL:
    Position the cursor on the name of the method and click on 'Redefine' , where you will get the parameters used in the method such as I_X, I_COLSPAN, where you can define your logic.
    hope it helps
    assign points if useful

  • ADF UI Shell Pattern- How to pass parameter to the called bounded taskflow?

    The sample Launcher class of the ADF UI Shell template has the following code:
        private void _launchActivity(String title, String taskflowId, boolean newTab)
          try
            if (newTab)
              TabContext.getCurrentInstance().addTab(
                title,
                taskflowId);
            else
              TabContext.getCurrentInstance().addOrSelectTab(
                title,
                taskflowId);
          catch (TabContext.TabOverflowException toe)
            // causes a dialog to be displayed to the user saying that there are
            // too many tabs open - the new tab will not be opened...
            toe.handleDefault();
        }How do I pass a parameter to the bounded taskflow that will be launched?
    For example:
    1) I have a list of employees displayed on a tab.
    2) When I select a record and click an edit button inside the tab, A separate tab should open with the corresponding employee to be edited.
    How then could I pass the employee id to the edit-employee-task-flow?
    I can't think on how/what would a "calling taskflow" come into this picture?
    help!
    pino
    Edited by: pino on 16-Dec-2009 05:57
    Edited by: pino on 16-Dec-2009 09:59

    Hi Arunkumar,
    Thanks for the info. I was actually using EJB DataControls, and something similar to what you have suggested can also be done programmatically, but I wanted to follow the one promoted in the Fusion Developers' Guide to take advantage of the "ADF task flow framework" (like pass-by-value, pageflowScope, etc.) especially that we were having problems when we will just follow the procedures that was presented in the tutorials(I mean that- not all the procedures in the tutorials will work on an application based on the UI Shell pattern which do have multiple active taskflows.).
    For instance, you have an active List of employees in one tab, and two other tabs that try to edit employee records. If these employee list and employee edit forms are based on a single iterator binding, then what would happen to the information in the two edit forms on each separate tabs if you selected another row on the employee list tab? -- In our case, the edit tabs' values synchronized to the new selected row in the list tab.
    There are sure many work-arounds for these, but I am looking for a cleaner, clearer, or best way to handle this scenario.
    regards,
    pino

  • How to pass parameter to 1 method in adf 11g

    Hi,
    <af:panelAccordion id="id25" clientComponent="true" visible="true" inlineStyle="height:90%;">
    MyBean.leftKey=list
    <af:iterator id="keyId" value="#{MyBean.leftKey}" var="bean">
    <af:showDetailItem text="#{bean.text}" id="arraylistValues">
    (bean.text) which is a KEY, i need to pass to 1 method HERE. ------so that, i can get corresponding ArrayList #{mybean.listPerKey}
    <af:iterator id="mybeanListValuesId" value="#{mybean.listPerKey}" var="bean">
    --some logic...
    </af:iterator
    </af:showDetailItem>
    </af:iterator
    </af:panelAccordion>
    im trying to display the panelaccordion with showdetailitem dynamically.
    logic : 1st iterator rotates for no of keys, that key i want to pass before second iterator so that i can retrieve corresponding list.
    how to call bean method with parameter.
    regards,
    sandeep

    Hi,
    this one would be simple..
    <af:panelAccordion id="id25" clientComponent="true" visible="true" inlineStyle="height:90%;">
    <af:iterator id="keyId" value="#{MyBean.leftKey}" var="bean">
    <af:showDetailItem text="#{bean.text}" id="arraylistValues">
    <af:iterator id="mybeanListValuesId" value="#{mybean.listPerKey}" var="bean">
    --some logic...
    </af:iterator
    </af:showDetailItem>
    </af:iterator
    </af:panelAccordion>in the getListPerKey method you can eaisly get the *#{bean.text}* value , for that you just need to eveluate it.
    Reference code
        public Object evaluateExpressionGet(String expression,
                                            Class expectedType) {
            return getFacesContext().getApplication().evaluateExpressionGet(getFacesContext(),
                                                                            expression,
                                                                            expectedType);
        public FacesContext getFacesContext() {
            return FacesContext.getCurrentInstance();
        public List getListPerKey() {
           Object key = evaluateExpressionGet("#{bean.text}",Object.class);
           return listPerKey;
        here you can eaisly get the corrosponding row values from parent iterator..
    Regards,
    Santosh.

  • Pass parameter to ssrs report in performance point webpart from textbox text

    How to pass parameter to ssrs report  in performance point webpart from textbox text
    Please help me to solve this ...
    Bikky Kumar

    Edit your SharePoint page and add new text filter web part.
    Then pass the text filter value to your performance point report using connections. Your report should include at least one parameter to get the value. More over you can set default value in text filter.

  • How to Open PopUp from Managed Bean?

    Hi,
    Can you please let me know how can we open a pop up from managed bean.
    Thanks & Regards,
    Kiran Konjeti

    Hi,
    I got the answer for this question.
    Write the following code in Managed Bean
    ==========================
    private RichOutputText errorText;
    private RichPopup PopUp;
    Generate accessors(setters & getters) for these 2 variablesAnd place this method in your managed bean.
    > private void showPopup(RichPopup popUp, UIComponent source) {
    > FacesContext context = FacesContext.getCurrentInstance();
    > String popupId = popUp.getClientId(context);
    > String alignId = source.getClientId(context);
    > StringBuilder script = new StringBuilder();
    > script.append("var popup = AdfPage.PAGE.findComponent('").append(popupId).append("'); ").append("if (!popup.isPopupVisible()) { ").append("var hints = {}; ").append("hints
    [AdfRichPopup.HINT_ALIGN_ID] = '").append(alignId).append("'; ").append("hints[AdfRichPopup.HINT_ALIGN] = AdfRichPopup.ALIGN_AFTER_START; ").append("popup.show(hints);}");> ExtendedRenderKitService erks =
    > Service.getService(context.getRenderKit(),
    > ExtendedRenderKitService.class);
    > erks.addScript(context, script.toString());
    > }
    Now, how to call this method from your managed bean ... depends upon situation.
    public void sendEmailstoBorrowers(ActionEvent actionEvent) {
    .....................some logic ...............> if(true){
    > personHistoryStatus = defaultPreventionHelper.writeBorrowerHistory(borrowersList,getFormattedAction());
    > this.errorText.setValue((borrowersList != null ? borrowersList.size() : "")+" E-mails have been sent successfully..!");
    > }else{
    > this.errorText.setValue("Unable to send emails. Please contact System Administrator..!");
    > }
    > showPopup(this.getPopUp(), actionEvent.getComponent());
    }And ... what do we need to do on the UI??
    Write the following code in UI -- Here is the button which calls sendEmail method
    ==================================================
    ><af:commandButton text="SEND" id="cb3"
    >shortDesc="Click 'Send' to send emails."
    >styleClass="defaultButton"
    >blocking="true"
    >disabled="#{pageFlowScope.DefaultPreventMB.disablePrintButton || bindings.DelinquentBorrowersList.estimatedRowCount == 0}"
    >rendered="#{pageFlowScope.DefaultPreventMB.formattedAction eq 'E-mail'}"
    >partialTriggers="t2:dlDelete"
    >actionListener="#{pageFlowScope.DefaultPreventMB.sendEmailstoBorrowers}"/>
    Once this button get clicked ... it calls sendEmailstoBorrowers, and based on the result(either true or false) the method sets the content for the pop up and opens the popup from managed bean.
    And here is the code for which we have to keep inside the jsff and this gets invoked from managed bean.
    ><af:popup id="p1" binding="#{pageFlowScope.DefaultPreventMB.popUp}">
    > <af:dialog id="d1" type="ok" title="E-mail Communication Status">
    ><af:outputText value="E-mails have been sent successfully..!"
    > id="ot11"
    >binding="#{pageFlowScope.DefaultPreventMB.errorText}"/>
    ></af:dialog>
    ></af:popup>
    Let me know if you need more information about it.
    Thanks & Regards,
    Kiran Konjeti

  • How to Pass parameter to Custom Scheduler dynamically

    hi ,
    I am new to OIM.
    Need your help in passing parameters dynamically to Custom Scheduler.
    I have created Custom Scheduler by extending Task Support.
    I have registered the plugin through API , using PlatformService.registerPlugin() method.
    As I need to send the parameter(s) to this CustomScheduler, I have defined them in Metadata (CustomScheduleTask.xml) file as below and got it imported into DB
    through weblogicImportMetadata.sh script by providing the path of the file.
    <scheduledTasks xmlns="http://xmlns.oracle.com/oim/scheduler">
    <task>
    <name>CustomScheduleTask</name>
    <class>org.schedule.custom.task.CustomScheduleTask</class>
    <description>Fetch details of the given user_id</description>
    <retry>5</retry>
    <parameters>
    <string-param required="true" helpText="Login Name">Login Name</string-param>
    </parameters>
    </task>
    </scheduledTasks>
    Iam able to import this plugin as well as register the plugin successfully. Now I have defined a job to which this Custom SchedulerTask is mapped.
    Now in order to run this job(schedule task) I need to provide Login name( or id) which needs to be send as a parameter for the scheduler to get executed.
    But while defining the job with this Schedule Task on OIM console, I was not able to define or pass parameter to this job. hence parameter is null in
    CustomSchedule 's execute method .
    Kindly help me how to pass parameter dynamically while running the scheduler from OIM console so that the execute method would be able to receive it.
    Thank you in Advance.
    Regards,
    Kumar

    Hi,
    When you have created the schedule job for your custom schedule task, you should see your Login Name textfield in the schedule task. If not, then there verify your schedule task xml.
    In your schedule class code, add:
    public void execute(HashMap arg0) {
              final String METHOD_NAME = "execute :: ";
              logger.debug(CLASS_NAME + METHOD_NAME + "Entering Method - execute");
              try {
                   String LoginName = arg0.get("Login Name");
    Regards,
    Sunny

  • Passing parameter in a method

    hi i have a situation where i have to pass parameter to my method i don't what to pass the parameter define from the viewO because am not using parameter to query from the view,i just what to pass it to my procedure,my method is
                    public void submit_agr(String par_id,String dref_id,String tas_id,String agr_id){
                        ViewObject sub = this.findViewObject("AGR1");
                      i don't what to use this-> sub.setNamedWhereClauseParam("tas_id", tas_id); the tas_id is not in AGR1 VIEWO
                      // sub.
                        sub.executeQuery();
                        Row row = sub.first();
                        par_id = (String)row.getAttribute("par_id");
                        agr_id = (String)row.getAttribute("id");
                        callPerformSdmsLogon("SMS_FORM_TO_ADf.delete_agr(?)", new  Object[] {par_id,dref_id,tas_id,agr_id});
                    }

    i try this AM IN jDEVELOPER 11.1.2.1.0
                    public void submit_agr(String par_id,String dref_id,String tas_id,String agr_id){
                        ViewObject sub = this.findViewObject("AGR1");                 
                        Row row = sub.first();
                        sub.setNamedWhereClauseParam("tas_id", new Number(10));-how will i pass this to my procedure
                        sub.setNamedWhereClauseParam("dref_id", new Number(10));-how will i pass this to my procedure
                        par_id = (String)row.getAttribute("par_id");
                        agr_id = (String)row.getAttribute("id");
                        sub.executeQuery();
                        callPerformSdmsLogon("SMS_FORM_TO_ADf.delete_agr(?)", new  Object[] {par_id,dref_id,tas_id,agr_id});
                    }how will i pass the two prameter to my procedure
    Edited by: Tshifhiwa on 2012/07/01 3:14 PM

  • How to pass parameter as http POST in pageContext.setForwardURL

    Hi,
    I need to call a third party application page in my custom OAF page. I need to pass parameter to this third party page using POST method. I am using following command to call that -
    HashMap hm = new HashMap();
    hm.put("FirstName",firstName );
    hm.put("LastName",lastName);
    hm.put("AppSignature", signature);
    pageContext.setForwardURL(hopURL,
    null, // not necessary with KEEP_MENU_CONTEXT
    OAWebBeanConstants.KEEP_MENU_CONTEXT, // no change to menu context
    null, // No need to specify since we're keeping menu context
    hm, // request parameters
    false, // retain the root application module
    OAWebBeanConstants.ADD_BREAD_CRUMB_YES, // display breadcrumbs
    OAException.ERROR);
    I am passing parameter to the page using hash map table. That application is expecting the parameters in POST format and I believe using hash map table the parameters will be passed as GET format.
    We figured that out because one of the parameter we have to send is AppSignature which is 160 characters long. When third party applicatoin received that parameter they got only 151 characters, looks like they are truncated by GET method.
    Any idea how to pass parameter using POST format so that this issue could be fixed.
    Regards
    Hitesh

    Sumit,
    Thanks for your reply. I have resolved this issue by forwarding all parameters in session using pageContext.putSessionValueDirect and redirect to a jsp using pageContext.redirectImmediately.
    in jsp I read the params from session and set in the form , and then redirected to my third party application.
    Regards
    Hitesh

  • How to pass parameter /1BCDWB/DOCPARAMS from webdynpro?

    Hi Experts,
    We create a wdp view and indert an adobe form into it. And this form has an interface based on XML schema.
    Now we want to translate this form into multi-language, and in wdp side, we will display diffenent language version of form for different regions.
    I found that there is a paramater /1BCDWB/DOCPARAMS-LANGU, and it seems can control the language version in processing.
    But I donot know how to pass parameter /1BCDWB/DOCPARAMS from wdp to adobe form.
    Its my 1st to use adobe form and wdp, i really have no way out. Any advice will be Appreciated.
    Thank you.
    Richard

    @sahai: Hey no , I am using very very simple example without any query or complex statement. I just have 2 radio buttons in VIEW1. On clicking the radio button, the naviagtion to view2 is done and the value of selected radio button is passed as a parameter in the plug.
    In the view2 , i just have a caption in my layout where i am displaying the parameter value by setting the attribute.THe warning i get is in view2. Here is the code. Apart from this there is no coding in view2.
    METHOD HANDLEPLUG_IN_V2 .
        DATA:
          NODE_CAPT_MSG                       TYPE REF TO IF_WD_CONTEXT_NODE,
          ELEM_CAPT_MSG                       TYPE REF TO IF_WD_CONTEXT_ELEMENT,
          STRU_CAPT_MSG                       TYPE IF_VIEW2=>ELEMENT_CAPT_MSG ,
          ITEM_MSG                            LIKE STRU_CAPT_MSG-MSG.
    *   navigate from <CONTEXT> to <CAPT_MSG> via lead selection
        NODE_CAPT_MSG = WD_CONTEXT->GET_CHILD_NODE( NAME = `CAPT_MSG` ).
    *   get single attribute
        NODE_CAPT_MSG->SET_ATTRIBUTE(
          EXPORTING
            NAME =  `MSG`
            VALUE = PAR_1 ).
    ENDMETHOD.

  • How to pass parameter into a source variable of a invoke activity

    I'm an new BPELer, I created a invoke activity to submit Oracle Appplications concurrent program, but I don't know how to pass parameter into source variable.
    BTW, I have created the mapper file (.xsl) file.
    could anyone tell me how to do that?
    Thanks,
    Victor

    Hi.
    How you start application? I think you send message to webservice(BPEL process is webservice too). So construct message with variable and value.
    But I created only processes where input value doesn't matter. I haven't use mapper yet too.

  • Passing parameter to the i18n text from xml view in fiori app

    Hi,
    Could somebody let me know how to pass parameter to get the i18n text inside xml view of a Fiori app.
    For e.g. inside my i18n properties file i have a entry like:
    PEC_ISSUE={0}issues of total{1}
    inside xml i use it like {i18n>PEC_ISSUE}
    but now how do i pass those 2 parameters to this ??
    i know in javascript it works with , (comma) but does not work in xml. Any help...
    Thanks,
    Ashish

    Hi Michele,
    I found it. Below is the example from my coding.
    <Text      text="{parts: [{path: 'i18n>PEC_to'}, {path: 'promoprocsteps>RetailPromotionSalesFromDate_E'},
                                                           {path:'promoprocsteps>RetailPromotionSalesToDate_E'}],
                                                           formatter: 'retail.promn.promotioncockpit.utils.Formatter.formatDatesString'}"  />
    So you have to create a formatter and pass all the strings to the formatter and then do it inside JS.
    In JS you do it in this way:
    i18n.getText(i18String, [newString, string2]);
    i hope this helps.
    Regards,
    Ashish

Maybe you are looking for

  • Graphics issues since latest 10.8.2 update

    Last Friday, I applied the latest update to 10.8 (10.8.2?). Since then I have noticed a couple of issues, both of which appear to be graphics related. FWIW, my hardware is an early 2011, 15-inch MBP with discrete graphics (Radeon 6750M). 1. In one in

  • The ABAP/4 Open SQL array insert results in duplicate database records

    Hi, Iam getting following error : The ABAP/4 Open SQL array insert results in duplicate database records. Error in ABAP application program. The current ABAP program "SAPLV60U" had to be terminated because one of the statements could not be executed.

  • SYNTAX ERROR in function module CACS_BUPA_PAI_SPECIAL_CACSB1

    Hi experts,    I am trying to create business partner in SAP treasury module with role - general business partner and validity period 01/01/0001 - 12/31/9999. I am gettting syntax error  in Function module CACS_BUPA_PAI_SPECIAL_CACSB1, it says The ke

  • Calling sets in an ABAP program

    i am working on a validation exit for FI. Is it possible to create sets to group data and call the sets in a ABAP program in a validation exit. Any clarification will be appreciated. thank you Krishna

  • Doctype problem

    Hi, I am developing webpages by creating templates through dreamweaver. I use asp code. I just discovered that when I view the source code through a browser, the doctype doesn't appear. The webmaster checked the asp code and said it was fine. Could t