File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes struts html:checkbox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts html:checkbox" Watch "struts html:checkbox" New topic
Author

struts html:checkbox

vidya mahavadi
Ranch Hand

Joined: Nov 24, 2004
Posts: 34
Hi,

I am working on a JSP which uses an action form and <logic:iterate to iterate through the records. Action form looks like this.

public class searchNotifForm extends ActionForm{

ArrayList notifications;

public void setNotifications(ArrayList notifications){
this.notifications = notifications;
}

public ArrayList getNotifications(){
return this.notifications ;
}
}

In JSP I am looping through the list using <logic:iterate> and displaying the records.

<table>
<logic:iterate id="notification" name="searchNotifForm" property="notifications" type="NotificationDisplayObject">
<tr>
<td class="bodyCopy" width="10%" align="center">
<html:ext styleClass="button" name="notification" property="brokerName" />
/td>
<td class="bodyCopy" width="10%" align="center">
<html:checkbox name="notification" property="email"/>
</td>
</logic:iterate>
</table>

The issue is the checkbox does not persist state in the object. Am I missing something here..
Kushal Thakore
Greenhorn

Joined: Nov 21, 2005
Posts: 3
vidya,
You need to use multibox instead of a checkbox. It returns an String[].

So for your case it would be:
<html:multibox property="email">

And the form:
private String[] email;
and getter and setter for email. You just loop through the String[] to check the values!

hope this helps.

Kushal
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: struts html:checkbox