You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Kartik Kumar <kr...@gmail.com> on 2010/04/28 22:31:05 UTC

Submit not passing the form input to the action

Hi,

I have a use case in which we iterate through the items in the list and
display them on the page. We do that with s:iterator tag.

<s:iterator value="actionItems">
        <tr>
            <td><s:property value="creatorName" /></td>
            <td><s:property value="assignedTo" /></td>
            <td><s:property value="creationDate" /></td>
            <td><s:property value="dueTo" /></td>
            <td><s:property value="externalItemNumber" /></td>
            <td><s:property value="description" /></td>
            <td><s:property value="currentStatus" /></td>
            <td width="100"><s:property value="status"/></td>
            <td>*<s:select name="actionStatus" headerKey=""
                 headerValue="Change Status" list="statuses" />*
            </td>
            <td>
              <s:hidden name="id"/>
             * <s:submit value="Update" name="update" />*
            </td>
        </tr>
    </s:iterator>

I have a s:submit tag that inovkes the appropriate action class and method.
For update to work, I have to to update the back end with a new pull down
menu value from db and is given below:

*<s:select name="actionStatus" headerKey=""
                 headerValue="Change Status" list="statuses" />*

I also have a hidden field "id" that I used to identify the identity of the
bean to be updated and is given below:
<s:hidden name="id"/>

and I have a submit button for every entry in the list being iterated

My issues is that my action class is not getting any value from "id" and
"actionStatus" field even though they are defined in my action class. I
don't know what is going wrong. The action is being invoked but these fields
have a null value.

Any help would be appreciated.

Thanks,

Kartik

Re: Submit not passing the form input to the action

Posted by Kartik Kumar <kr...@gmail.com>.
Hi Martin,

Thanks for replying. I loked at I am iterating through the collection to
display some the items as follows:

<s:iterator value="actionItems">
        <tr>
           <td><s:property value = "status" /></td>
            <td><s:select name="action" headerKey=""
                 headerValue="Change Status" list="statuses" />
            </td>
            <td>
            <s:hidden name="id" />
            <s:submit name="update" value = "Change"/>
            </td>
        </tr>
    </s:iterator>

There is a submit button for every row. I want to update the value of a bean
attribute status with the value from the drop down. I have tried to change
the invocation from submit to get using <s:action><s:param  name ="idValue"
value = "id" /></s:action>. But I am not able to get status attribute to be
populated in my action class.


On Wed, Apr 28, 2010 at 5:27 PM, Martin Gainty <mg...@hotmail.com> wrote:

>
> the list attribute defined is the variable bound from the action as seen
> here with a bound Collection variable called availableItems
>
>    <s:select list="#skillAction.availableItems" listKey="name" label="Main
> Skill"
>               name="currentEmployee.mainSkill.name"/>
> public abstract class AbstractCRUDAction extends ActionSupport {
>    private Collection availableItems;
>
> the hidden field needs a value attribute and a id attribute as seen here:
> <s:hidden id="project-name" name="project-name" value="Struts 2" />
>
> Martin Gainty
> ______________________________________________
> Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
>
> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
> Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
> dient lediglich dem Austausch von Informationen und entfaltet keine
> rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
> E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
> destinataire prévu, nous te demandons avec bonté que pour satisfaire
> informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
> de ceci est interdite. Ce message sert à l'information seulement et n'aura
> pas n'importe quel effet légalement obligatoire. Étant donné que les email
> peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
> aucune responsabilité pour le contenu fourni.
>
>
>
>
> > Date: Wed, 28 Apr 2010 13:31:05 -0700
> > Subject: Submit not passing the form input to the action
> > From: krishnan.1000@gmail.com
> > To: user@struts.apache.org
> >
> > Hi,
> >
> > I have a use case in which we iterate through the items in the list and
> > display them on the page. We do that with s:iterator tag.
> >
> > <s:iterator value="actionItems">
> >         <tr>
> >             <td><s:property value="creatorName" /></td>
> >             <td><s:property value="assignedTo" /></td>
> >             <td><s:property value="creationDate" /></td>
> >             <td><s:property value="dueTo" /></td>
> >             <td><s:property value="externalItemNumber" /></td>
> >             <td><s:property value="description" /></td>
> >             <td><s:property value="currentStatus" /></td>
> >             <td width="100"><s:property value="status"/></td>
> >             <td>*<s:select name="actionStatus" headerKey=""
> >                  headerValue="Change Status" list="statuses" />*
> >             </td>
> >             <td>
> >               <s:hidden name="id"/>
> >              * <s:submit value="Update" name="update" />*
> >             </td>
> >         </tr>
> >     </s:iterator>
> >
> > I have a s:submit tag that inovkes the appropriate action class and
> method.
> > For update to work, I have to to update the back end with a new pull down
> > menu value from db and is given below:
> >
> > *<s:select name="actionStatus" headerKey=""
> >                  headerValue="Change Status" list="statuses" />*
> >
> > I also have a hidden field "id" that I used to identify the identity of
> the
> > bean to be updated and is given below:
> > <s:hidden name="id"/>
> >
> > and I have a submit button for every entry in the list being iterated
> >
> > My issues is that my action class is not getting any value from "id" and
> > "actionStatus" field even though they are defined in my action class. I
> > don't know what is going wrong. The action is being invoked but these
> fields
> > have a null value.
> >
> > Any help would be appreciated.
> >
> > Thanks,
> >
> > Kartik
>
> _________________________________________________________________
> The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with
> Hotmail.
>
> http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5
>

RE: Submit not passing the form input to the action

Posted by Martin Gainty <mg...@hotmail.com>.
the list attribute defined is the variable bound from the action as seen here with a bound Collection variable called availableItems

    <s:select list="#skillAction.availableItems" listKey="name" label="Main Skill"
               name="currentEmployee.mainSkill.name"/>
public abstract class AbstractCRUDAction extends ActionSupport {
    private Collection availableItems;

the hidden field needs a value attribute and a id attribute as seen here:
<s:hidden id="project-name" name="project-name" value="Struts 2" />

Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.




> Date: Wed, 28 Apr 2010 13:31:05 -0700
> Subject: Submit not passing the form input to the action
> From: krishnan.1000@gmail.com
> To: user@struts.apache.org
> 
> Hi,
> 
> I have a use case in which we iterate through the items in the list and
> display them on the page. We do that with s:iterator tag.
> 
> <s:iterator value="actionItems">
>         <tr>
>             <td><s:property value="creatorName" /></td>
>             <td><s:property value="assignedTo" /></td>
>             <td><s:property value="creationDate" /></td>
>             <td><s:property value="dueTo" /></td>
>             <td><s:property value="externalItemNumber" /></td>
>             <td><s:property value="description" /></td>
>             <td><s:property value="currentStatus" /></td>
>             <td width="100"><s:property value="status"/></td>
>             <td>*<s:select name="actionStatus" headerKey=""
>                  headerValue="Change Status" list="statuses" />*
>             </td>
>             <td>
>               <s:hidden name="id"/>
>              * <s:submit value="Update" name="update" />*
>             </td>
>         </tr>
>     </s:iterator>
> 
> I have a s:submit tag that inovkes the appropriate action class and method.
> For update to work, I have to to update the back end with a new pull down
> menu value from db and is given below:
> 
> *<s:select name="actionStatus" headerKey=""
>                  headerValue="Change Status" list="statuses" />*
> 
> I also have a hidden field "id" that I used to identify the identity of the
> bean to be updated and is given below:
> <s:hidden name="id"/>
> 
> and I have a submit button for every entry in the list being iterated
> 
> My issues is that my action class is not getting any value from "id" and
> "actionStatus" field even though they are defined in my action class. I
> don't know what is going wrong. The action is being invoked but these fields
> have a null value.
> 
> Any help would be appreciated.
> 
> Thanks,
> 
> Kartik
 		 	   		  
_________________________________________________________________
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with Hotmail. 
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5

Re: Submit not passing the form input to the action

Posted by Dale Newfield <da...@newfield.org>.
On 4/29/10 2:13 PM, Kartik Kumar wrote:
> @Nikhil No action form used as I am using Struts2. Each row has a submit
> button.

Each row should have it's own form.

-Dale

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


Re: Submit not passing the form input to the action

Posted by Kartik Kumar <kr...@gmail.com>.
@Nikhil No action form used as I am using Struts2. Each row has a submit
button.
2010/4/29 निखिल वाळवेकर <wa...@gmail.com>

> Can you please also provide ActionForm details ?
>
> Is your page like this? (I am not aware abt struts 2 tags)
>
> <form action="someAction">
> .......
> <s:iterator value="actionItems">
>       <tr>
>           <td><s:property value="creatorName" /></td>
>           <td><s:property value="assignedTo" /></td>
>           <td><s:property value="creationDate" /></td>
>           <td><s:property value="dueTo" /></td>
>           <td><s:property value="externalItemNumber" /></td>
>           <td><s:property value="description" /></td>
>           <td><s:property value="currentStatus" /></td>
>           <td width="100"><s:property value="status"/></td>
>           <td>*<s:select name="actionStatus" headerKey=""
>                headerValue="Change Status" list="statuses" />*
>           </td>
>           <td>
>             <s:hidden name="id"/>
>            * <s:submit value="Update" name="update" />*
>           </td>
>       </tr>
>   </s:iterator>
> ......
> </form>
>
> *One form tag covering s:iterator.*
> *
> *
> In that case even if you have one submit button per row, whole form will be
> submitted and your actionForm will be populated.
>
> Regards,
> Nikhil
>
> On Thu, Apr 29, 2010 at 12:42 PM, Jyothi Rajesh <jy...@gmail.com>
> wrote:
>
> > Not sure about struts 2, but in struts 1.3, there will need to be a
> > collection object in the action form and this will need to be
> instantiated
> > while declaring. And there needed to be getters and setters for the
> entire
> > collection as well as inidiviual members with index.
> >
>
>
>
> --
> Nikhil
>

Re: Submit not passing the form input to the action

Posted by निखिल वाळवेकर <wa...@gmail.com>.
Can you please also provide ActionForm details ?

Is your page like this? (I am not aware abt struts 2 tags)

<form action="someAction">
.......
<s:iterator value="actionItems">
       <tr>
           <td><s:property value="creatorName" /></td>
           <td><s:property value="assignedTo" /></td>
           <td><s:property value="creationDate" /></td>
           <td><s:property value="dueTo" /></td>
           <td><s:property value="externalItemNumber" /></td>
           <td><s:property value="description" /></td>
           <td><s:property value="currentStatus" /></td>
           <td width="100"><s:property value="status"/></td>
           <td>*<s:select name="actionStatus" headerKey=""
                headerValue="Change Status" list="statuses" />*
           </td>
           <td>
             <s:hidden name="id"/>
            * <s:submit value="Update" name="update" />*
           </td>
       </tr>
   </s:iterator>
......
</form>

*One form tag covering s:iterator.*
*
*
In that case even if you have one submit button per row, whole form will be
submitted and your actionForm will be populated.

Regards,
Nikhil

On Thu, Apr 29, 2010 at 12:42 PM, Jyothi Rajesh <jy...@gmail.com> wrote:

> Not sure about struts 2, but in struts 1.3, there will need to be a
> collection object in the action form and this will need to be instantiated
> while declaring. And there needed to be getters and setters for the entire
> collection as well as inidiviual members with index.
>



-- 
Nikhil

Re: Submit not passing the form input to the action

Posted by Jyothi Rajesh <jy...@gmail.com>.
Not sure about struts 2, but in struts 1.3, there will need to be a
collection object in the action form and this will need to be instantiated
while declaring. And there needed to be getters and setters for the entire
collection as well as inidiviual members with index.