1) No, but it will work. Look at previous posts on how to properly
implement.
2) Your form should have get and set methods?
3) Collection
4) None that I am aware of.

-----Original Message-----
From: Strichartz, Beth [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 24, 2001 1:09 PM
To: [EMAIL PROTECTED]
Subject: Help with Struts and EJBS..


Hi,
I need some serious help.
I am a novice Java and Struts developer.
I am trying to develope a prototype that will work with backend EJBS..

I have an CustomerSearchForm, Form bean and  action bean
my Action class is below.

Questions?
1) Is this the appropriate way to call EJBS (in an action class)??
2) How do I get what is returned from the EJB back into my actionform bean?
3) If I want a list of matching customers retruned...what is the best format
for these to be returned from the EJB so that I can
forward to another jsp and show them..  Currently the EJB is returning a
string.
4) Is there any sample applications out there that I can look at that use
EJBs?

Thanks in advance for ANY help.
Beth.


public ActionForward perform
        (ActionMapping mapping, ActionForm form,
        HttpServletRequest request, HttpServletResponse response)
    {
        ActionForward fwdAction = null;
        CustomerSearchForm searchForm = (CustomerSearchForm) form;
        try {

            // Get an InitialContext
            Properties initProps = new Properties();
            initProps.put (Context.INITIAL_CONTEXT_FACTORY,
                "weblogic.jndi.WLInitialContextFactory");
            initProps.put(Context.PROVIDER_URL,
                "t3://yshen:7001");
            Context ctx =  new InitialContext(initProps);

            Object home = (CustomerFacadeHome)
ctx.lookup("sov/CustomerFacade");
            CustomerFacadeHome customerFacadeHome = (CustomerFacadeHome)
PortableRemoteObject.narrow
                (home, CustomerFacadeHome.class);

            CustomerFacade facade = (CustomerFacade)
PortableRemoteObject.narrow
                (customerFacadeHome.create(), CustomerFacade.class);

            String[] found  = facade.findCustomer
(searchForm.getCustomerName (),
                searchForm.getSsn (), searchForm.getAlphaKey (),
                searchForm.getBank ());

            for (int i=0; i<found.length; i++) {
                System.out.println ("\t[" + i + "]\t" + found[i]);
            }
            fwdAction = mapping.findForward ("success");
        } catch (Exception e) {

            e.printStackTrace ();
            fwdAction = mapping.findForward ("failed");
        }

        return fwdAction;
    }




This message contains information which may be confidential and privileged.
Unless you are the addressee  (or authorized to receive for the addressee),
you may not use, copy or disclose to anyone the message or any information
contained in the message.  If you have received the message in error, please
advise the sender by reply e-mail, and delete or destroy the message.

Thank you.


Reply via email to