File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Problem in setting bean value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem in setting bean value" Watch "Problem in setting bean value" New topic

Problem in setting bean value

mohsin sheikh

Joined: Mar 28, 2007
Posts: 22
I am developing a project as Task Tracking System.One of the entities used in my project are Client and Task.So i build the form bean for Client and Task.
The Client form Bean consists:Client Id,ClientName.The Task form bean consists of TaskId,TaskName,Description,CreateDate,Status etc.The Relation between client and task is of one to many relation.Now i want to show the list of task with their client.For this i am taking an arraylist and from the database i am picking the resultset containing taskid,taskname,createdate,clientid,clientname.Now the problem is that how should i set the bean value and store that in ArrayList so that i can print all the information.How should i create the relation.The relation is one to many.should i build another bean which extend task and add some repeated attributes like clientid, clientname etc(from client).Please give me suggestion on my problem(what should i do).

Please give me the suggestion of how to solve the above problem.I will be very grateful to you.
Anirvan Majumdar
Ranch Hand

Joined: Feb 22, 2005
Posts: 261
In your Client form bean have an ArrayList for holding Task form bean instances.
Once you get the resultset from the DB, create an ArrayList of the Client form bean where each form bean will contain a list of the associated tasks and also the particular Client's details.
mohsin sheikh

Joined: Mar 28, 2007
Posts: 22
Thanks for your reply but i didn't get you.Can you explain it in more detail.
If possible,also give me some code related to my problem.Thanks in advance
I agree. Here's the link:
subject: Problem in setting bean value
It's not a secret anymore!