8 Replies Latest reply on Dec 6, 2012 12:44 PM by Gandhaveedi

    to call stored procedure inside servlet.java class

    Gandhaveedi
      Hi,

      I am using JDEV 11GR2.

      My requirement is i need to call store procedure in my servlet java class.

      I am able to call store procedure in my backing bean class: this is done mi the following manner.

      1. created method in AppModuleImpl class and expose same method in client interface.
      2. Added method in the test.jspx page pagedef.xml and execute the same in backing bean test.java in the following manner:

      FacesContext facesContext = FacesContext.getCurrentInstance();
      Application app = facesContext.getApplication();
      ExpressionFactory elFactory = app.getExpressionFactory();
      ELContext elContext = facesContext.getELContext();
      ValueExpression valueExp =
      elFactory.createValueExpression(elContext, "#{bindings}", Object.class);
      BindingContainer binding= (BindingContainer)valueExp.getValue(elContext);
      OperationBinding operationBinding=binding.getOperationBinding("procedure_name");
      // Set the Input parameters to the operation bindings as below
      operationBinding.getParamsMap().put("OrgName", "org");
      //operationBinding.getParamsMap().put("SiteIdentifier", "M");
      // Invoke the Application module method
      operationBinding.execute();

      the above approach is working fine.

      Now my question is how can I call the method written inside AppModuleImpl, in servlet.java(Servlet will not be having any jspx page and this will be executed before the link is launched in the browser).

      please suggest me if there are any alternatives as well.

      Thanks,
      Veeresh