Solved

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

Posted on 2004-08-18
8
276 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
[X]
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
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Tutorials alone can't teach real engineering

So we built better training tools.

-Hands-on Labs
-Instructor Mentoring
-Scenario-Based Tests
-Dedicated Cloud Servers

All at your fingertips. What are you waiting for?

Question has a verified solution.

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

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

726 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