Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2004-08-18
8
261 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
ID: 11838508
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:Mayank S
ID: 11843284
>> 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
ID: 11896773
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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 30

Assisted Solution

by:Mayank S
Mayank S earned 200 total points
ID: 11899757
Hi Sangeeta,

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

Rgds,
Mayank.
0
 
LVL 35

Assisted Solution

by:girionis
girionis earned 300 total points
ID: 11900020
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:Mayank S
Mayank S earned 200 total points
ID: 11900175
0
 
LVL 2

Author Comment

by:sangeetha
ID: 11901108
Ok...thanks.
0
 
LVL 35

Expert Comment

by:girionis
ID: 11901144
:)
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
egit plugin on eclipse 8 82
HashTable highest marks enumeration alternative 9 43
spring jars download 1 35
JavaFX TableView not displaying correctly 3 58
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

829 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