Solved

Creating a Class in EJB and using it in my Struts Forms.

Posted on 2004-08-18
8
234 Views
Last Modified: 2013-11-24
Hi,

Please look here:

http://jaggybala.clawz.com/CalendarTool/ShowList.html

At present i have 3 JSP's, 2 Form-Bean and 2 Form-Action as follows:

     JSP                       Form-Bean               Form-Action
  ------------              -----------------         -------------------
  FilterList.jsp           FilterForm.java           FilterAction.java
 RegisterList.jsp       RegiterForm.java        RegisterAction.java
 ShowList.jsp                   ---                             ---

ShowList.jsp includes FilterList.jsp and RegisterList.jsp

At the bottom, you can see a list of members.

Q is : *I want to populate a colleciton of members with dummy objects and return it from inside the EJB.*

I was adviced by girinois as:
--------------------------------
Just create the EJB (obtain the home interface) and then call the remote method on the EJB. In one of the remote methods pass an array or a vector of the dummy objects you have. Then do the processing you want in the EJB.

I am a new-bie for EJB and Struts... Could anyone give me some code hints...

Thanks for reading.
0
Comment
Question by:sangeetha
  • 3
  • 3
  • 2
8 Comments
 
LVL 35

Accepted Solution

by:
girionis earned 300 total points
Comment Utility
It depends on what you want to do inside your EJB. Do you want to create the list in there or create the list somewhere else, pass it in the EJB, do your processing and then return the result. Since you already have an action form you might as well create the list in the action form although you might as well create it in the EJB. A solution would be to pass the HttpSerlvetRequest object but this is tend to avoid this.

What I suggest is that you might want to take a look here: http://www.devx.com/Java/Article/21065 for integrating EJBs and struts, go through the sample code, understand what's going on and then come back to here and ask a question again? I think it is a good tutorial and will give you a basic understanding fo what's going on using ejbs and struts.
0
 
LVL 30

Expert Comment

by:mayankeagle
Comment Utility
>> I want to populate a colleciton of members with dummy objects and return it from inside the EJB

I would assume that you want to create the list of members inside the EJB. You just need to code it like any normal method which returns a Collection (if you wanna use Collections). Do you want help with writing code to obtain the home interface, etc?

Which server are you using?

Make sure that anything which is passed to the EJB or returned from it is serialized.
0
 
LVL 2

Author Comment

by:sangeetha
Comment Utility
thanks for your replies. sorry for being late.
The article was good, but i find it bit difficult to copw up with home interface, remote interface, etc...

Could you please explain me how and when to use home interface/remote interface. I am using JBoss server.

all the tutorials are too advanced for my java knowledge.

thanks again.
0
 
LVL 30

Assisted Solution

by:mayankeagle
mayankeagle earned 200 total points
Comment Utility
Hi Sangeeta,

Try a basic tutorial first - http://www.ejbtut.com

Rgds,
Mayank.
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 35

Assisted Solution

by:girionis
girionis earned 300 total points
Comment Utility
I agree with mayankeagle, read a tutorial on EJBs first: http://developer.java.sun.com/developer/onlineTraining/EJBIntro/EJBIntro.html it will you give you an understanding of what's going on.
0
 
LVL 30

Assisted Solution

by:mayankeagle
mayankeagle earned 200 total points
Comment Utility
0
 
LVL 2

Author Comment

by:sangeetha
Comment Utility
Ok...thanks.
0
 
LVL 35

Expert Comment

by:girionis
Comment Utility
:)
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now