This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Struts and the fly likes Problem in Bean(Design) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem in Bean(Design)" Watch "Problem in Bean(Design)" New topic
Author

Problem in Bean(Design)

mohsin sheikh
Greenhorn

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 bean for Client and Task.
The Client Bean consists:Client Id,ClientName,ClientStatus.The Task bean consists of TaskId,TaskName,Description,CreateDate,TaskStatus etc.The Relation between client and task is of one to many relation.So I include Clientid in Task Bean.Now i want to show the list of task with their client as

ClientName ClientStatus TaskName CreateDate TaskStatus....

For this i am getting the above data from the database .Now i want to set the bean properties after getting the resultset from the database.Now the problem is that which bean property should i set.If i taset the Task property,i will do as follows....
Task task=new task();
task.setTaskName(rs.getString(1))
task.setClentId(rs.setClientId(rs.getInt(2))....etc

Now how will i set the property for ClientName and Client Status properties.
And i want the total records in a bean so that i can print the bean value using get method on JSP.So how should i set the bean value and store that in ArrayList so that i can print all the information.Please resolve the above problem and also new ideas to solve the above problem in anothe way is most welcome.But any way i will stick to setting bean properties.
Thanks in advance
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
Posting the same question twice is not recommended....plus I do not see anything in your question that is related to Struts.

- Brent
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problem in Bean(Design)