struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dean A. Hoover" <dhoo...@rochester.rr.com>
Subject form processing
Date Wed, 19 May 2004 23:59:17 GMT
I don't quite understand how DynaActionForm
gets populated when a form is submitted. The
form I have gets processed exactly as I expect,
except for a group of checkboxes (generated in
JSP by a custom tag I wrote). If I have one or
more checked it works fine. However, if I uncheck
all of them, it fails. The boxes come in checked
as they were before I unchecked all. I'm using
struts 1.1 and am generating
some checkboxes that look like this in
the JSP:

...
<form name="seriesProps" method="post" action="/ChangeSeriesProps.do" style="margin-bottom:0;">
...
<tr>
<td valign="top"><input type="checkbox" name="categoryIds" value="2"/></td>
<td class="text" valign="top">
<img src="images/spacer.gif" width="1" height="1" alt="">Health &amp; Fitness<br/>
<table cellpadding="0" cellspacing="0">
<tr>
<td valign="top"><input type="checkbox" name="categoryIds" value="6"/></td>
<td class="text" valign="top"><img src="images/spacer.gif" width="1" height="1" alt="">Diet<br/>
</td>
</tr>
<tr>
<td valign="top"><input type="checkbox" name="categoryIds" value="7"/></td>
<td class="text" valign="top">
<img src="images/spacer.gif" width="1" height="1" alt="">Fitness<br/>
</td>
</tr>
<tr>
...

When it hits my ChangeSeriesProps Action:
   public ActionForward execute
    (
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response
    ) throws Exception
    {
        DynaActionForm vForm = (DynaActionForm)form;
        log.debug("AAA: change properties: " + vForm.toString());

The log shows:
2004-05-19 18:47:38 DEBUG ChangeSeriesProps.java:52 - AAA: change properties: DynaActionForm[dynaClass=seriesProps,categoryIds={7},title=Life's
a Bowl of Cherries xxx,description=Life is indeed a bowl of cherries xxx,strategy=weekdays,weekdays={Monday,Wednesday,Friday}]

The struts-config.xml has this definition:

    <form-bean name="seriesProps"
               type="org.apache.struts.action.DynaActionForm">
      <form-property name="title"
                     type="java.lang.String"/>
      <form-property name="description"
                     type="java.lang.String"/>
      <form-property name="categoryIds"
                     type="java.lang.String[]"/>
      <form-property name="strategy"
                     type="java.lang.String" initial="deltaDays"/>
      <form-property name="weekdays"
                     type="java.lang.String[]"/>
    </form-bean>
...
    <action path="/ChangeSeriesProps"
            type="fi.els.action.ChangeSeriesProps"
            name="seriesProps"
            validate="false"
            input="tiles.editSeriesProps"
            parameter="method">
      <forward name="success" path="/EditSeries.do"/>
      <forward name="failure" path="/editSeriesProps.do"/>
      <forward name="cancel" path="/EditSeries.do"/>
    </action>


Any ideas why categoryIds is *not* empty?

Dean Hoover





---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message