Originally posted by Shailesh Pillai:
My jsp:
-----------------------------------
<html:select property="empNo">
<html options collection="EmpForm" property="empNo" labelProperty="empLbl"/>
</html:select>
-----------------------------------
In my Action class i am passing an ArrayList as the parameter to the setter method in EmpForm.
In EmpForm i have two objects : empNo and empLbl (both are ArrayList objects)
Can someone sort it out where i am going wrong.
[ May 01, 2006: Message edited by: Shailesh Pillai ]
Originally posted by Shailesh Pillai:
[QB]Thanks a lot for ur reply,
But tell me one thing in my Action class 'EmpAction' i am getting the values from the database & storing it in an array. In the 'EmpForm' how will i get the array and populate for each elements of the ArrayList Employees in 'EmpForm'.
Should i make use of 'org.apache.struts.util.LabelValueBean'.
And if i use LabelValueBean i don't think i require the 'Employee' class.
Following is my EmpForm
[QB]
Originally posted by Brent Sterling:
First off...for something like the code you posted to work, you would have to move the line "Employee emp=new Employee();" inside the for loop. Otherwise, each loop just updates the same instance and you will end up with a list full of duplicate objects.
- Brent
Originally posted by Shailesh Pillai:
Can any one figure out.....
Originally posted by Shailesh Pillai:
Hello Raghavendra,
Can you tell me what this iterate id is for?
And, when i am using the above code in my jsp.
I am getting the exception :
-----------
No getter method for property: "Employees" of bean: "EmpForm"
------------
[ May 04, 2006: Message edited by: Shailesh Pillai ]
Originally posted by Shailesh Pillai:
But, now i am getting an empty drop-down box with no values.
I am trying out....
Originally posted by Shailesh Pillai:
Do i need to do logic:iterate in my JSP as specified by Raghavendra.
Originally posted by Shailesh Pillai:
Thanks a LOT Jass and Brent,
It worked.
Nothing was wrong with the Java Code.
The problem was - I was missing the semi-colon between
<html optionsCollection>.
I think you might have also missed it in the post - Jass.
But once again thanks a lot, the funda is clear now.
Regards,
Shailesh
[ May 09, 2006: Message edited by: Shailesh Pillai ]
The harder I work, the luckier I get. -Sam Goldwyn So tiny. - this ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|