Dear Mano,

I need to display the employees from the emp table
emp table is having following columns
1) empid
2) fname
3) lname
4) email
5) mobile ...etc

so when i fire a query i will be getting Result Set. while looping the
result set i am creating EmployeeBean

eg:

while(rs.next()){
EmployeeBean objEmployee= new EmployeeBean();
objEmployee.setEmpID(rs.getString(1));

similarly for other properties of the bean
then add this to ArrayList
al.add(objEmployee);

} // end of while loop

after that sending the arraylist to jsp thru request.setAttribute

in JSP now i need to iterate the ArrayList of Employee Beans
and display in a form

hope this is clear now. in this case not using any FormBean. directly
getting ArrayList and sending thru request.

so please give me the code template that i need to use
my arraylist name : al
my employee bean name : EmployeeBean
properties in bean: empID,firstName,middleName,...etc



On 12/14/06, mano dasanayake <[EMAIL PROTECTED]> wrote:

Hi ,
I'm using 1.2 any how...what I mean in the Iterate code is that you simply
Define an ID for the bean that you are about to iterate...

For an instance,


<logic:iterate id="EMp" name="YourFormBean" property="EmplyList"
type="com.yourCom.common.beans.Employee ">


</logic:iterate>

So you'r going to iterate thru your "EmplyList" and refer
Each of ur bean by name "EMp".
Then you can get whatever the attribute you want from your
Bean,(Employee).

For this case I think better to use <html:multibox>,,,
Can you explain your requirement specifically?

Regards,
Mano







-----Original Message-----
From: Kranti Parisa [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 13, 2006 3:06 PM
To: Struts Users Mailing List
Subject: Re: logic:iterate for arraylist of beans

Hi Mano,

In the code you have written <logic:iterate id="Emp" type=""...>

"Emp" should be the name of the ArrayList right?

and in logic:iterate type is there? i hope you mean to say collection=""
..

and i need to submit the form after selecting what ever checkboxes that i
need to delete and then click on the detele button.but in the code that
you
gave me will submit the orm when i click on the checkbox i think.

the problem is for the "value" of the checkbox
i should assign the value of the checkbox as empid. so that when i submit
the form we can capture all the checked empid using req.gerParamaterValues

please suggest something


On 12/14/06, mano dasanayake <[EMAIL PROTECTED]> wrote:
>
> Hi,
> As I understood what you have to do is,
> Iterate through your list and add checkboxes as folllwing...
>
> <logic:iterate id="Emp" type=""...>
>
> <html:checkbox  property="prop1" value="true"
> onclick="submitForm("editaction.do?id=<bean:write name="Emp"
> property="ID"/>")" />
> <bean:write name="Emp" property="name"/>
>
>
> </logic:iterate>
>
> Regards,
> Mano
>
>
>
>
> -----Original Message-----
> From: Kranti Parisa [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, December 13, 2006 2:07 PM
> To: Struts Users Mailing List
> Subject: logic:iterate for arraylist of beans
>
> hi,
>
> i am facing proble for the following
> =========================
> assigning value to check box
>
> say logic:iterate is having arraylist
> this arraylist is with beans
> means for example employee bean
> i want to view all emps in jsp
> what we will do is we create a bean for each employee
> and add tht bean to arraylist
> so tht we have this arraylist in jsp
> then we use logic:iterate
> to iterate the arraylist
> now we need to print the rows
> each row contains a check box
> this check box should get the value as empid
> so tht when i select the checkbox
> we can do delete or modify..etc
> ============================
>
> plzzzzz suggest/help from this.
> stuck up completely with this.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


--
------------------
Best Regards
Kranti Kiran Kumar Parisa
Mobile: +91 - 9849 - 625 - 625             +91 - 9391 - 438 - 738



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
------------------
Best Regards
Kranti Kiran Kumar Parisa
Mobile: +91 - 9849 - 625 - 625             +91 - 9391 - 438 - 738

Reply via email to