lensi
asked on
Using sTRUTS lOGIC ItERATOR TAG
HI Guys
need an idea or suggestion..
say i have a class Employee which has its own get and set methods
and i have a class Role which has its own get and set methods
and i have a joining class Employee_Role which has Employee object and Role object and get and set methods for it..
Well i have a vector (as collection object)
for loop
{
vector.add(employee);
vector.add(role);
vector.add(employee_role);
}
since i need to display list of employees with their role names....
like BELOW..
Employee id ------- Employee name ---- Employee role name
Now i want to use iterator .. i have vector in the same class with scope as "request"..
request.setAttribute("empl oyee_role" ,employee_ roles_vect or); // From bean iam getting vector..Vice versa i can do there in bean itself....
---SOME CODE-------
-----SOME CODE-----
------SOME CODE----
<logic:iterate id="emp_role" property="employee_role" scope="request" type="supportingClasses.Ge tEmployees ">
<html:text name="emp_role" property="mg_employee.id"/ >
</logic:iterate>
but iam getting org.apache.jasper.JasperEx ception: Null attribute name
but i dont have any field as name..since employee has first_name and role has role_name..
Well anyway i want to figure out my understanding on Iterator first....
I mean if i have a collection of objects in an iterator where each object is its own type and to retrieve the object properties we simply need to iteate the collection object ...
if my understanding is right then is my code rght ???????????..
or the way iam doing is wrong... ?????????????????
Since iam a new bee iam trying to learn ..anyone's suggestion or advice would help me better...
Cheers
lenin
need an idea or suggestion..
say i have a class Employee which has its own get and set methods
and i have a class Role which has its own get and set methods
and i have a joining class Employee_Role which has Employee object and Role object and get and set methods for it..
Well i have a vector (as collection object)
for loop
{
vector.add(employee);
vector.add(role);
vector.add(employee_role);
}
since i need to display list of employees with their role names....
like BELOW..
Employee id ------- Employee name ---- Employee role name
Now i want to use iterator .. i have vector in the same class with scope as "request"..
request.setAttribute("empl
---SOME CODE-------
-----SOME CODE-----
------SOME CODE----
<logic:iterate id="emp_role" property="employee_role" scope="request" type="supportingClasses.Ge
<html:text name="emp_role" property="mg_employee.id"/
</logic:iterate>
but iam getting org.apache.jasper.JasperEx
but i dont have any field as name..since employee has first_name and role has role_name..
Well anyway i want to figure out my understanding on Iterator first....
I mean if i have a collection of objects in an iterator where each object is its own type and to retrieve the object properties we simply need to iteate the collection object ...
if my understanding is right then is my code rght ???????????..
or the way iam doing is wrong... ?????????????????
Since iam a new bee iam trying to learn ..anyone's suggestion or advice would help me better...
Cheers
lenin
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Cool :-)
Good luck with it :-)
Tim
Good luck with it :-)
Tim
ASKER
Cheers
lenin