You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by aum strut <au...@gmail.com> on 2008/03/27 17:34:04 UTC

Calling Action on form load

Hi all,

is it possible to call an action in struts2  everytime when the page get
loaded if yes how it is possible.
my problem is i am using <s:select> tag and using a list to pupulate this
drop down this list is coming from the action which i m calling before the
page is being displayed.

the folw is like this:

if usercall for this JSP page instaed to direct user directly  to this page
i m calling an action which is preaparing a list for the <s:select> tag
and then it is forwarding the user to this page.

Till now eveything is working fine,but when on this page user is entering
some values in the fields and hitting the submitting button,exception is
being thrown which is saying that:


select', field 'list', name 'code': The requested list key 'ItemCode' could
not be resolved as a collection/array/map/enumeration/iterator type.
Example: people or people.{name} - [unknown location]

because i thik it is unable to call the action again which is returning the
list...is theer any way to call that action each time when user is
submitting the value..



any pointer in this regard will be much appriciated.

-aum

Re: Calling Action on form load

Posted by aum strut <au...@gmail.com>.
Jane your solutions is working fine...
was doing a small mistake from my end..

thanks for helping me out..

-aum


On 3/28/08, aum strut <au...@gmail.com> wrote:
>
> Hi Jane,
>
> what i m doing in my action class i am putting the list in the session
> like this
>
> Map<String, ArrayList<String>> session = ActionContext.*getContext*
> ().getSession();
>
> session.put(
> "value",itemCode);
> and in my jsp page i m trying to retrieving the values like this:
>
> <
> s:select label="Select Code" cssClass="large" list="%{#session.value}"
>
> name="code"
>
> headerKey="1"
>
> headerValue="-- Select Item Codet --"
>
> list="ItemCode"
>
> />
> but when ever i m hitting the submitt button it is giving me the exception
>
> tag 'select', field 'list', name 'code': The requested list key 'ItemCode'
> could not be resolved as a collection/array/map/enumeration/iterator type.
> Example: people or people.{name} - [unknown location]
> any suggestion in this regard??
> -aum
>
>
>  On 3/27/08, Jiang, Jane (NIH/NCI) [C] <ji...@mail.nih.gov> wrote:
> >
> > Aum,
> >
> > After you retrieve the list in your action, save it in session using
> >
> > session.put("mySelectionList", list);
> >
> > Then in your jsp, use the list in session for s:selection.
> >
> >   <s:select name="mysSelection" cssClass="large" value="selectedValue"
> >              list="%{#session.mySelectionList}" listKey="value"
> >              listValue="label" />
> >
> > Hope this helps,
> >
> > Jane
> >
> > -----Original Message-----
> > From: aum strut [mailto:aum.struts@gmail.com]
> > Sent: Thursday, March 27, 2008 1:08 PM
> > To: Struts Users Mailing List
> > Subject: Re: Calling Action on form load
> >
> > Jane,
> >
> > can you just give me a brief aidea about (or even if u can a demo code )
> > how
> > u put ur list in to the action.
> >
> > that will be of gr8 help
> >
> > --aum
> >
> >
> > On 3/27/08, Randy Burgess <RB...@nuvox.com> wrote:
> > >
> > > Use the <s:action> tag.
> > >
> > > http://struts.apache.org/2.x/docs/action.html
> > >
> > > Regards,
> > > Randy Burgess
> > > Sr. Web Applications Developer
> > > Nuvox Communications
> > >
> > >
> > >
> > > > From: aum strut <au...@gmail.com>
> > > > Reply-To: Struts Users Mailing List <us...@struts.apache.org>
> > > > Date: Thu, 27 Mar 2008 22:04:04 +0530
> > > > To: Struts Users Mailing List <us...@struts.apache.org>
> > > > Subject: Calling Action on form load
> > > >
> > > > Hi all,
> > > >
> > > > is it possible to call an action in struts2  everytime when the page
> > get
> > > > loaded if yes how it is possible.
> > > > my problem is i am using <s:select> tag and using a list to pupulate
> > > this
> > > > drop down this list is coming from the action which i m calling
> > before
> > > the
> > > > page is being displayed.
> > > >
> > > > the folw is like this:
> > > >
> > > > if usercall for this JSP page instaed to direct user directly  to
> > this
> > > page
> > > > i m calling an action which is preaparing a list for the <s:select>
> > tag
> > > > and then it is forwarding the user to this page.
> > > >
> > > > Till now eveything is working fine,but when on this page user is
> > > entering
> > > > some values in the fields and hitting the submitting
> > button,exception is
> > > > being thrown which is saying that:
> > > >
> > > >
> > > > select', field 'list', name 'code': The requested list key
> > 'ItemCode'
> > > could
> > > > not be resolved as a collection/array/map/enumeration/iterator type.
> > > > Example: people or people.{name} - [unknown location]
> > > >
> > > > because i thik it is unable to call the action again which is
> > returning
> > > the
> > > > list...is theer any way to call that action each time when user is
> > > > submitting the value..
> > > >
> > > >
> > > >
> > > > any pointer in this regard will be much appriciated.
> > > >
> > > > -aum
> > >
> > >
> > >
> > > This email and any attachments ("Message") may contain legally
> > privileged
> > > and/or confidential information.  If you are not the addressee, or if
> > this
> > > Message has been addressed to you in error, you are not authorized to
> > read,
> > > copy, or distribute it, and we ask that you please delete it
> > (including all
> > > copies) and notify the sender by return email.  Delivery of this
> > Message to
> > > any person other than the intended recipient(s) shall not be deemed a
> > waiver
> > > of confidentiality and/or a privilege.
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > > For additional commands, e-mail: user-help@struts.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>

Re: Calling Action on form load

Posted by aum strut <au...@gmail.com>.
Hi Jane,

what i m doing in my action class i am putting the list in the session like
this

Map<String, ArrayList<String>> session = ActionContext.*getContext*
().getSession();

session.put("value",itemCode);
and in my jsp page i m trying to retrieving the values like this:

<s:select label="Select Code" cssClass="large" list="%{#session.value}"

name="code"

headerKey="1"

headerValue="-- Select Item Codet --"

list="ItemCode"

/>
but when ever i m hitting the submitt button it is giving me the exception

tag 'select', field 'list', name 'code': The requested list key 'ItemCode'
could not be resolved as a collection/array/map/enumeration/iterator type.
Example: people or people.{name} - [unknown location]
any suggestion in this regard??

-aum


On 3/27/08, Jiang, Jane (NIH/NCI) [C] <ji...@mail.nih.gov> wrote:
>
> Aum,
>
> After you retrieve the list in your action, save it in session using
>
> session.put("mySelectionList", list);
>
> Then in your jsp, use the list in session for s:selection.
>
>   <s:select name="mysSelection" cssClass="large" value="selectedValue"
>              list="%{#session.mySelectionList}" listKey="value"
>              listValue="label" />
>
> Hope this helps,
>
> Jane
>
> -----Original Message-----
> From: aum strut [mailto:aum.struts@gmail.com]
> Sent: Thursday, March 27, 2008 1:08 PM
> To: Struts Users Mailing List
> Subject: Re: Calling Action on form load
>
> Jane,
>
> can you just give me a brief aidea about (or even if u can a demo code )
> how
> u put ur list in to the action.
>
> that will be of gr8 help
>
> --aum
>
>
> On 3/27/08, Randy Burgess <RB...@nuvox.com> wrote:
> >
> > Use the <s:action> tag.
> >
> > http://struts.apache.org/2.x/docs/action.html
> >
> > Regards,
> > Randy Burgess
> > Sr. Web Applications Developer
> > Nuvox Communications
> >
> >
> >
> > > From: aum strut <au...@gmail.com>
> > > Reply-To: Struts Users Mailing List <us...@struts.apache.org>
> > > Date: Thu, 27 Mar 2008 22:04:04 +0530
> > > To: Struts Users Mailing List <us...@struts.apache.org>
> > > Subject: Calling Action on form load
> > >
> > > Hi all,
> > >
> > > is it possible to call an action in struts2  everytime when the page
> get
> > > loaded if yes how it is possible.
> > > my problem is i am using <s:select> tag and using a list to pupulate
> > this
> > > drop down this list is coming from the action which i m calling
> before
> > the
> > > page is being displayed.
> > >
> > > the folw is like this:
> > >
> > > if usercall for this JSP page instaed to direct user directly  to
> this
> > page
> > > i m calling an action which is preaparing a list for the <s:select>
> tag
> > > and then it is forwarding the user to this page.
> > >
> > > Till now eveything is working fine,but when on this page user is
> > entering
> > > some values in the fields and hitting the submitting
> button,exception is
> > > being thrown which is saying that:
> > >
> > >
> > > select', field 'list', name 'code': The requested list key
> 'ItemCode'
> > could
> > > not be resolved as a collection/array/map/enumeration/iterator type.
> > > Example: people or people.{name} - [unknown location]
> > >
> > > because i thik it is unable to call the action again which is
> returning
> > the
> > > list...is theer any way to call that action each time when user is
> > > submitting the value..
> > >
> > >
> > >
> > > any pointer in this regard will be much appriciated.
> > >
> > > -aum
> >
> >
> >
> > This email and any attachments ("Message") may contain legally
> privileged
> > and/or confidential information.  If you are not the addressee, or if
> this
> > Message has been addressed to you in error, you are not authorized to
> read,
> > copy, or distribute it, and we ask that you please delete it
> (including all
> > copies) and notify the sender by return email.  Delivery of this
> Message to
> > any person other than the intended recipient(s) shall not be deemed a
> waiver
> > of confidentiality and/or a privilege.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

RE: Calling Action on form load

Posted by "Jiang, Jane (NIH/NCI) [C]" <ji...@mail.nih.gov>.
 Aum,

After you retrieve the list in your action, save it in session using

session.put("mySelectionList", list);

Then in your jsp, use the list in session for s:selection.

   <s:select name="mysSelection" cssClass="large" value="selectedValue"
              list="%{#session.mySelectionList}" listKey="value"
              listValue="label" />

Hope this helps,

Jane

-----Original Message-----
From: aum strut [mailto:aum.struts@gmail.com] 
Sent: Thursday, March 27, 2008 1:08 PM
To: Struts Users Mailing List
Subject: Re: Calling Action on form load

Jane,

can you just give me a brief aidea about (or even if u can a demo code )
how
u put ur list in to the action.

that will be of gr8 help

--aum


On 3/27/08, Randy Burgess <RB...@nuvox.com> wrote:
>
> Use the <s:action> tag.
>
> http://struts.apache.org/2.x/docs/action.html
>
> Regards,
> Randy Burgess
> Sr. Web Applications Developer
> Nuvox Communications
>
>
>
> > From: aum strut <au...@gmail.com>
> > Reply-To: Struts Users Mailing List <us...@struts.apache.org>
> > Date: Thu, 27 Mar 2008 22:04:04 +0530
> > To: Struts Users Mailing List <us...@struts.apache.org>
> > Subject: Calling Action on form load
> >
> > Hi all,
> >
> > is it possible to call an action in struts2  everytime when the page
get
> > loaded if yes how it is possible.
> > my problem is i am using <s:select> tag and using a list to pupulate
> this
> > drop down this list is coming from the action which i m calling
before
> the
> > page is being displayed.
> >
> > the folw is like this:
> >
> > if usercall for this JSP page instaed to direct user directly  to
this
> page
> > i m calling an action which is preaparing a list for the <s:select>
tag
> > and then it is forwarding the user to this page.
> >
> > Till now eveything is working fine,but when on this page user is
> entering
> > some values in the fields and hitting the submitting
button,exception is
> > being thrown which is saying that:
> >
> >
> > select', field 'list', name 'code': The requested list key
'ItemCode'
> could
> > not be resolved as a collection/array/map/enumeration/iterator type.
> > Example: people or people.{name} - [unknown location]
> >
> > because i thik it is unable to call the action again which is
returning
> the
> > list...is theer any way to call that action each time when user is
> > submitting the value..
> >
> >
> >
> > any pointer in this regard will be much appriciated.
> >
> > -aum
>
>
>
> This email and any attachments ("Message") may contain legally
privileged
> and/or confidential information.  If you are not the addressee, or if
this
> Message has been addressed to you in error, you are not authorized to
read,
> copy, or distribute it, and we ask that you please delete it
(including all
> copies) and notify the sender by return email.  Delivery of this
Message to
> any person other than the intended recipient(s) shall not be deemed a
waiver
> of confidentiality and/or a privilege.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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


Re: Calling Action on form load

Posted by aum strut <au...@gmail.com>.
Jane,

can you just give me a brief aidea about (or even if u can a demo code ) how
u put ur list in to the action.

that will be of gr8 help

--aum


On 3/27/08, Randy Burgess <RB...@nuvox.com> wrote:
>
> Use the <s:action> tag.
>
> http://struts.apache.org/2.x/docs/action.html
>
> Regards,
> Randy Burgess
> Sr. Web Applications Developer
> Nuvox Communications
>
>
>
> > From: aum strut <au...@gmail.com>
> > Reply-To: Struts Users Mailing List <us...@struts.apache.org>
> > Date: Thu, 27 Mar 2008 22:04:04 +0530
> > To: Struts Users Mailing List <us...@struts.apache.org>
> > Subject: Calling Action on form load
> >
> > Hi all,
> >
> > is it possible to call an action in struts2  everytime when the page get
> > loaded if yes how it is possible.
> > my problem is i am using <s:select> tag and using a list to pupulate
> this
> > drop down this list is coming from the action which i m calling before
> the
> > page is being displayed.
> >
> > the folw is like this:
> >
> > if usercall for this JSP page instaed to direct user directly  to this
> page
> > i m calling an action which is preaparing a list for the <s:select> tag
> > and then it is forwarding the user to this page.
> >
> > Till now eveything is working fine,but when on this page user is
> entering
> > some values in the fields and hitting the submitting button,exception is
> > being thrown which is saying that:
> >
> >
> > select', field 'list', name 'code': The requested list key 'ItemCode'
> could
> > not be resolved as a collection/array/map/enumeration/iterator type.
> > Example: people or people.{name} - [unknown location]
> >
> > because i thik it is unable to call the action again which is returning
> the
> > list...is theer any way to call that action each time when user is
> > submitting the value..
> >
> >
> >
> > any pointer in this regard will be much appriciated.
> >
> > -aum
>
>
>
> This email and any attachments ("Message") may contain legally privileged
> and/or confidential information.  If you are not the addressee, or if this
> Message has been addressed to you in error, you are not authorized to read,
> copy, or distribute it, and we ask that you please delete it (including all
> copies) and notify the sender by return email.  Delivery of this Message to
> any person other than the intended recipient(s) shall not be deemed a waiver
> of confidentiality and/or a privilege.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: Calling Action on form load

Posted by Randy Burgess <RB...@nuvox.com>.
Use the <s:action> tag.

http://struts.apache.org/2.x/docs/action.html

Regards,
Randy Burgess
Sr. Web Applications Developer
Nuvox Communications



> From: aum strut <au...@gmail.com>
> Reply-To: Struts Users Mailing List <us...@struts.apache.org>
> Date: Thu, 27 Mar 2008 22:04:04 +0530
> To: Struts Users Mailing List <us...@struts.apache.org>
> Subject: Calling Action on form load
> 
> Hi all,
> 
> is it possible to call an action in struts2  everytime when the page get
> loaded if yes how it is possible.
> my problem is i am using <s:select> tag and using a list to pupulate this
> drop down this list is coming from the action which i m calling before the
> page is being displayed.
> 
> the folw is like this:
> 
> if usercall for this JSP page instaed to direct user directly  to this page
> i m calling an action which is preaparing a list for the <s:select> tag
> and then it is forwarding the user to this page.
> 
> Till now eveything is working fine,but when on this page user is entering
> some values in the fields and hitting the submitting button,exception is
> being thrown which is saying that:
> 
> 
> select', field 'list', name 'code': The requested list key 'ItemCode' could
> not be resolved as a collection/array/map/enumeration/iterator type.
> Example: people or people.{name} - [unknown location]
> 
> because i thik it is unable to call the action again which is returning the
> list...is theer any way to call that action each time when user is
> submitting the value..
> 
> 
> 
> any pointer in this regard will be much appriciated.
> 
> -aum



This email and any attachments ("Message") may contain legally privileged and/or confidential information.  If you are not the addressee, or if this Message has been addressed to you in error, you are not authorized to read, copy, or distribute it, and we ask that you please delete it (including all copies) and notify the sender by return email.  Delivery of this Message to any person other than the intended recipient(s) shall not be deemed a waiver of confidentiality and/or a privilege.

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


RE: Calling Action on form load

Posted by "Jiang, Jane (NIH/NCI) [C]" <ji...@mail.nih.gov>.
Aum,

I know what you are talking about.  I end up putting all lists for
select tag in the session.  Otherwise, you will have to reload the list
every time the form submits and when validation error happens.  I'd like
to find out if there are other ways to get around too.

Jane



-----Original Message-----
From: aum strut [mailto:aum.struts@gmail.com] 
Sent: Thursday, March 27, 2008 12:34 PM
To: Struts Users Mailing List
Subject: Calling Action on form load

Hi all,

is it possible to call an action in struts2  everytime when the page get
loaded if yes how it is possible.
my problem is i am using <s:select> tag and using a list to pupulate
this
drop down this list is coming from the action which i m calling before
the
page is being displayed.

the folw is like this:

if usercall for this JSP page instaed to direct user directly  to this
page
i m calling an action which is preaparing a list for the <s:select> tag
and then it is forwarding the user to this page.

Till now eveything is working fine,but when on this page user is
entering
some values in the fields and hitting the submitting button,exception is
being thrown which is saying that:


select', field 'list', name 'code': The requested list key 'ItemCode'
could
not be resolved as a collection/array/map/enumeration/iterator type.
Example: people or people.{name} - [unknown location]

because i thik it is unable to call the action again which is returning
the
list...is theer any way to call that action each time when user is
submitting the value..



any pointer in this regard will be much appriciated.

-aum

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