Struts framework with Weblogic.

Discussions

EJB programming & troubleshooting: Struts framework with Weblogic.

  1. Struts framework with Weblogic. (2 messages)

    Hi!!
    I now need to use the Struts framework with Weblogic 6.0 , 7.0. I guess Struts 1.0.3 is a stable version which I should use(->comments?).

    Could anyone guide me with the steps to setup struts with WL 6.0, 7.0 and test the setup.

    I require to call the EJBs also.. how do these fit in the struts framework.

    regds.
  2. Its another Web Application, Nothing specific.

    1) download struts jar files into your WEB-INF/lib directory
    2) Create struts-config.xml and add your directives
    3) Create web.xml and weblogic.xml as required for your web application
    4) Make sure .tld files are in the right place
    5) Develop/Deploy your EJB files to the container ( you can use console )
    6) Look at http://jakarta.apache.org/struts/ for Developer docs and FAQs
    7) http://e-docs.bea.com/wls/docs70/index.html on how to deploy your web application
  3. Hi!!!
    I am trying to invoke an EJB from the Action class. However, the perform method is not called - the println's do not show up on the server console nor is any error thrown.

    ---------<<!-- ========== Form Bean Definitions ================= -->
      <form-beans>

        <form-bean name="submitForm"
                        type="hansen.playground.SubmitForm"/>

      </form-beans>

      <!-- ========== Action Mapping Definitions ============ -->
      <action-mappings>

        <action path="/submit"
                  type="hansen.playground.SubmitAction"
                  name="submitForm"
                  input="/submit.jsp"
                  scope="request">
        <forward name="success" path="/submit.jsp"/>
        <forward name="failure" path="/submit.jsp"/>
        </action>

      </action-mappings>

    -----------------------------------


    -------< public ActionForward perform(ActionMapping mapping,
          ActionForm form,
          HttpServletRequest request,
          HttpServletResponse response)throws IOException, ServletException {
    System.out.println("perform called !!!");
        SubmitForm f = (SubmitForm) form; // get the form bean
        // and take the last name value
        String lastName = f.getLastName();
        // Translate the name to upper case
        //and save it in the request object
        request.setAttribute("lastName", lastName.toUpperCase());
        
    /***** Calling EJB ***************************/

    String op="";
      try {
    System.out.println("getting initial context");
        Context ctx = getInitialContext();
    System.out.println("initial context got !!");
        DemoHome home = (DemoHome) ctx.lookup("Demo");
    System.out.println("home got !!");
    Demo ac = null;
        try {
          ac = (Demo) home.create();
    System.out.println("create called!!");
    if (ac==null)
    System.out.println("ac is null!");
        }
        catch (Exception ee) {
    System.out.print("exception 1");
        }
    System.out.println("going to call method!");
    if (ac!= null)
    op = ac.demoSelect();
    else
    System.out.println("ac is null->error!!");
    //out.println(ac.demoSelect());
    //out.println("string got!!");
    System.out.println("String="+op);
        }
        catch (Exception e) {
          
    e.printStackTrace();
    System.out.println("error 2");
        }
       /*********************************************/
        // Forward control to the specified success target
        return (mapping.findForward("success"));
      }
    ---------------------------------------

    What is wrong???