I change html:iterate tag to:

<logic:iterate id="item" name="multiboxTest" property="items">

the ="multiboxTest"  is the ActionForm bean's name in struts-config.xml.

and add getter/setter for items, now it works.

Thanks.

bruce


----- Original Message ----- 
From: "ZYD" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Thursday, November 06, 2003 10:23 AM
Subject: Re: multibox - Null attribute name ServletException


> Thanks for your response.
> Could you give me some hint? I'm a struts newbie.
> 
> Thanks a lot.
> 
> ----- Original Message ----- 
> From: "Firat TIRYAKI" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Thursday, November 06, 2003 11:04 PM
> Subject: Re: multibox - Null attribute name ServletException
> 
> 
> > store the properties in a bean and recall them in your action.
> > 
> > F.
> > 
> > 
> > ----- Original Message ----- 
> > From: "ZYD" <[EMAIL PROTECTED]>
> > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > Sent: Thursday, November 06, 2003 3:52 AM
> > Subject: multibox - Null attribute name ServletException
> > 
> > 
> > >
> > > 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;
> > >          }
> > > }
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> >

Reply via email to