Hi,

Not tried this but something like this should work

<logic:iterate id="user" name="users" property="users">
        <html:checkbox name="user" property="userId"/>
</logic:iterate>

Here the iterate 'name' attribute refers to the key value of an object in
request or session scope and the 'property' attribute refers to a getter (ie
users.getUsers) method on this object that returns a Collection of objects.
In this case a collection of user objects. Within the iterate block each of
these objects is referenced by the 'id'. The html:checkbox tag calls the
property of the object using this reference. In this case it calls
user.getUserId ().

Hope this helps.

Jon

-----Original Message-----
From: Deva Raju [mailto:[EMAIL PROTECTED]] 
Sent: 14 December 2001 04:31
To: [EMAIL PROTECTED]
Subject: How to solve it???


Hello,
This is a plain JSP - HTML code:
--------------------------------------------------------------
<%
for(i=0; i<objUsers.size(); i++){
        tmpuser=objUsers.getUser(i);
 %>
<tr><td> <input type=checkbox name=user value=<%= tmpuser.getUserId()%>>
<%=tmpuser.getUserId()%><td></tr>
<%
}
%>
------------------------------------------------------------

After running the above code and view the html source then i can see:

<tr><td> <input type=checkbox name=user value=chiru> chiru<td></tr>
<tr><td> <input type=checkbox name=user value=deva> deva<td></tr>
<tr><td> <input type=checkbox name=user value=ravi> ravi<td></tr>
<tr><td> <input type=checkbox name=user value=selvam> selvam<td></tr>

-------------------------------------------------------------------
Now I want to convert the above code to struts. For that how to design
my form class to map the values from HTML to Form class and action
class?
Because Its array of checkboxes. How to write set and get methods in the
form class.

Pls help me.
Regards,
Deva
MphasiS BFL Ltd.
139/1, Aditya Complex
Hosur Road, Koramangala
Bangalore - 560 095
India
Tel: (91)-80-552-2714
Extn. 2155
Architecting Value
SEI Level 5 ISO 9001 
****************************************
If you are honest and frank, people may cheat you;Be honest and frank
anyway



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

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

Reply via email to