Dear Piers,
Please try the following code.
logic:iterate id=record name=user
property=siteSection.newRecords
html:checkbox name=record value=off property=selectedFlag /
/logic:iterate
In your Form Bean,
- Implement following methods.
public Boolean [] getSelectedFlag();
public getSelectedFlag(Boolean [] flags);
In your Record class,
- Implement the methods.
public boolean getSelectedFlag();
public boolean setSelectedFlag(boolean flag).
When the JSP is executed, the values for the checkboxes will be
retrieved from the collection of Record objects.
When the form is submitted, the setSelectedFlag method on Form
bean will be called.
Please let me know if this works for you.
Ajay
Ajay Patil
Vertex Software Pvt. Ltd.
[EMAIL PROTECTED]
http://www.vertex.co.in
I have a logic:iterate tag which is supposed to create a dynamic
form, filled with a checkbox for every object in a collection. (The
checkbox is an option to delete one of those records from the
database.) The form itself is a Map-Backed Action form with two methods
(public void setValue(String key, Object value) and public Object
getValue(String key)).
logic:iterate id=record name=user
property=siteSection.newRecords
%
(dataobjects.Record) l = (dataobjects.Record)pageContext.findAttribute
(record);
String name= new String(value( + r.getID()+));
%
tr height=30
td align=center
html:checkbox value=off property=%=name% onclick=CheckMBRow
(this)/
/td td ..other stuff describing the record../td
/tr
/logic:iterate
Is there a way in Struts to do this without calling the record object
from the pageContext? Can't I get the html:checkbox tag to recognize
the 'record' bean directly without using that scriptlet and then
creating a String to set the appropriate mapped value?
Best,
Piers
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]