> 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..

taken those 3 into account, I think you really do need serious help. Not
being funny, but usually people either working with other experienced
developers or simply with a few years of Java and some EJB exposure should
be endevouring with such a task.

> 1) Is this the appropriate way to call EJBS (in an action class)?? 

yes, it's fine to call EJB's from the action class.

> 2) How do I get what is returned from the EJB back into my actionform
bean?

you (presumably) will get back an object/collection of data back from the
EJB. you can parse it and populatev the form with it/add to the request -
then pull it out in the jsp with the struts cust tags.


> 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.

see above. To reiterate, put it an Collection (ArrayList for example) or in
a custom Object (JavaBean.. not Enterprise Java Bean!!)

> 4) Is there any sample applications out there that I can look at that use
> EJBs?

as far as I know not of Struts/EJB. Weblogic comes with a good load of
examples, so does the Struts install.


Mike


===================================================
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.


=**********************************************************

If you are not the intended recipient, employee or agent responsible for delivering 
the message to the intended recipient, you are hereby notified that any dissemination 
or copying of this communication and its attachments is strictly prohibited.

If you have received this communication and its attachments in error, please return 
the original message and attachments to the sender using the reply facility on e-mail.

Internet communications are not secure and therefore the UCLES Group does not accept 
legal responsibility for the contents of this message.  Any views or opinions 
presented are solely those of the author and do not necessarily represent those of the 
UCLES Group unless otherwise specifically stated.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses although this does not guarantee that 
this email is virus free.

**********************************************************=

Reply via email to