Hi Viral

I am also using struts and developing a framework with struts which supports
ejb too. May I know the actual need to call ejb either by remote or local
interface depending on request? So that I can think in the direction of
getting the solution.

Shashank S. Dixit
Software Analyst.
Datamatics Ltd.
Contact: 28291253 ext 146
Mobile: 9820930075

Be brave against all odds. Never give up.


-----Original Message-----
From: Viral_Thakkar [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 20, 2003 5:57 PM
To: Struts Users Mailing List; [EMAIL PROTECTED]
Subject: RE : Remote and local EJB


Thanks for the reply.

I agree with this solution, but this does not solve the problem of accessing
the remote and local EJBs depending on the request.

-----Original Message-----
From: Laurent MARQUEZ [mailto:[EMAIL PROTECTED]
Sent: Monday, August 18, 2003 10:11 PM
To: 'Struts Users Mailing List'
Subject: RE : RE : Remote and local EJB

1-See on
http://www-106.ibm.com/developerworks/java/library/j-ejb1022.html
for pattern business delegate.

2-You must declare your EJB Local or remote or both interface in your
web.xml,
Like this foo example:

#ejb-ref>
#   <ejb-ref-name>
#     ejb/fr.artal.FooHome
#    </ejb-ref-name>
#    <ejb-ref-type>
#      Session
#    </ejb-ref-type>
#    <home>
#      fr.artal.FooHome
#    </home>
#    <remote>
#      fr.artal.Foo
#    </remote>
#    <ejb-link>
#      FooEJB
#    </ejb-link>
#  </ejb-ref>

3-Call your delegate interface, in your action class:
import org.apache.struts.action.Action;

#Public class FooAction extends Action
#{
#       //~ Static fields/initializers
---------------------------------------------
#
#       public static final String ID = "ID";
#       public static final String NAME = "NAME";
#
#       //~ Methods
----------------------------------------------------------------
#       protected ActionForward execute(
#               ActionMapping mapping,
#               ActionForm form,
#               HttpServletRequest request,
#               HttpServletResponse response)
#               throws Exception {
#
#               Integer id = null;
#               FooData fooData = null;
#
#               if (form != null)
#               {
#                       // using the form displayed in the view to get
the foo id
#                       String id =
(String)PropertyUtils.getSimpleProperty(form, "id");
#
#
#                       // using business delegate pattern to interface
with EJB session
#                       FooDelegate FooDelegate = new FooDelegate();
#
#
#                       fooData = FooDelegate.getFoo(id);
#               }
#               if (fooData != null)
#               {
#                       // set the request attribute
#                       String name = fooData .getName();
#
#                       request.setAttribute(ID, id);
#                       request.setAttribute(NAME, name);
#               }
#       }
#}

4- you can now, use the request object to display  all the foo fields in
your view(JSP)
Example foo data:
#<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
#<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
#
#<html:html>
#<head></head>
#<body>
#
#<table width=500
#       border="0" cellspacing="0" cellpadding="0">
#       <tr>
#               <td>Foo:</td>
#       </tr>
#       <tr>
#               <td> Id: <%= request.getAttribute("ID") %></td>
#       </tr>
#       <tr>
#               <td>&nbsp;</td>
#       </tr>
#       <tr>
#               <td> Name: <%= request.getAttribute("NAME") %></td>
#       </tr>
#       <tr>
#               <td>&nbsp;</td>
#       </tr>
#</table>
#</body>
#</html:html>


-----Message d'origine-----
De : Viral_Thakkar [mailto:[EMAIL PROTECTED]
Envoyé : lundi 18 août 2003 11:39
À : Struts Users Mailing List
Objet : RE: RE : Remote and local EJB


Business delegate pattern explains on how to use the business delegate
class. This pattern explains its usage and benefits.

Here I am interested in a solution which supports remote and local EJB
access depending on request. Any idea on this...???






-----Original Message-----
From: Laurent MARQUEZ [mailto:[EMAIL PROTECTED]
Sent: Monday, August 18, 2003 1:07 PM
To: 'Struts Users Mailing List'
Subject: RE : Remote and local EJB

Yes, you can interface EJB with Jakarta Struts
I use the pattern business delegate
See chapter 13
Of Programming Jakarta struts

-----Message d'origine-----
De : Viral_Thakkar [mailto:[EMAIL PROTECTED]
Envoyé : lundi 18 août 2003 07:35
À : Struts Users Mailing List
Objet : Remote and local EJB


Is there any struts support or any one has idea on following problem?

I am developing an application in which I require to develop an EJB with
local and remote interface. Local or remote EJB should be invoked
depending on the request. How one can identify this?
Any framework which support this local and remote EJB development and
access?




-----Original Message-----
From: Robert Leland [mailto:[EMAIL PROTECTED]
Sent: Monday, August 18, 2003 9:39 AM
To: [EMAIL PROTECTED]
Subject: [Validator] The Validator Wiki needs you !

There is now a Commons Validator Wiki !

Beware this is only a shell to start collecting tips, FAQs, and examples
for using validator. You can make a much needed contribution !

http://nagoya.apache.org/wiki/apachewiki.cgi?ValidatorProjectPages


This is also great opportunity to delete all those old emails you have
been saving !
Come on, there must be hundreds,  and put them on the web !

Then they are instantly available from any web browser:
* At work,
      Your Desk
      Your Co-worker's Desk
* At home
* At a remote site
* Even from that better paying job you have been waiting for !
   No emailing yourself hundreds of emails, just give your Notice ! ;-)

We really do need you !

--
Robert Leland                   [EMAIL PROTECTED]
------------------------------------------
Java, J2EE, Struts, Web Application Development

804 N. Kenmore Street           +01-703-525-3580
Arlington VA 22201



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to