I tried to use multibox. I copied the code snippet from Struts in Action, but I got:
[ServletException in:/WEB-INF/jsp/form/multiboxTest.jsp] Null attribute name' 
---------------------------------------------------
This is my multiboxTest.jsp:

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

<html:form action="/Multibox">

<table border="0" width="100%">

<logic:iterate id="item" property="items">
 <html:multibox property="selectedItems">
  <bean:write name="item"/>
 </html:multibox>
 <bean:write name="item"/>
</logic:iterate>

<!-- Buttons -->
<tr>
 <td>
     <html:submit property="ok" onclick="bCancel=false;">
   <bean:message key="button.ok"/>
  </html:submit> 
  &nbsp;
  <html:submit property="cancel" onclick="bCancel=true;">
   <bean:message key="button.cancel"/>
  </html:submit>
 </td>
</tr>
</table>
</html:form>
---------------------------------------------------
This is my ActionForm: MultiboxForm .java

public class MultiboxForm extends ActionForm
{
     private String[] selectedItems = {};
     private String[] items = { "UPS", "FedEx", "Airborne" };
     public String[] getSelectedItems()
     {
          return this.selectedItems;
     }
     public void setSelectedItems(String[] selectedItems)
     {
          this.selectedItems = selectedItems;
     }

     public ActionErrors validate(
          ActionMapping mapping,
          HttpServletRequest request)
         {
              ActionErrors errors = new ActionErrors();    
              return errors;
         }
}

Reply via email to