You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Sreekanth S. Nair" <sr...@egovernments.org> on 2013/08/02 09:36:47 UTC

How to initiate the select tag with empty list

Hi,
    Sometimes we need to provide an empty select tag which will be
populated later depending on some value in form using ajax. Now its
mandatory to provide at least an empty list to make select to work. Why
can't struts2 select tag can handle this case, where we can render the
select tag even we dont provide a prepopulated list?


-- 
Thanks & Regards
Srikanth

Re: How to initiate the select tag with empty list

Posted by "Sreekanth S. Nair" <sr...@egovernments.org>.
Ok :) thanks.

-- 
Thanks & Regards
Srikanth
Software Developer
--------------------------------
eGovernments Foundations
www.egovernments.org
Mob : 9980078913
--------------------------------


On Fri, Aug 2, 2013 at 11:55 PM, Chris Pratt <th...@gmail.com>wrote:

> No, that's why you can give it an empty list, you just can't give it null.
>  You may be able to specify list="%{{}}" which should be OGNL syntax for an
> empty list.
>   (*Chris*)
>
>
> On Fri, Aug 2, 2013 at 11:06 AM, Sreekanth S. Nair <
> sreekanth.nair@egovernments.org> wrote:
>
> > I understood your point chris,
> > This _multiselect_xyz parameter is created by a struts multiselect tag  ,
> > does it playing any role?
> > Not for a debate but as a question, does struts2 select tag is going to
> > loose anything if it renders an empty select ?
> >
> > --
> > Thanks & Regards
> > Srikanth
> >
> > On Fri, Aug 2, 2013 at 11:26 PM, Chris Pratt <thechrispratt@gmail.com
> > >wrote:
> >
> > > There's no real advantage to using the <s:select> tag if you already no
> > > there's no data to be displayed (remember, the struts tags are for
> > display
> > > only, they play absolutely no part in processing the posted form).
>  What
> > > you need is an empty <select> tag with a name that matches a mutator in
> > > your action.  Struts (and your jQuery) will do the rest.
> > > (*Chris*)
> > >
> > >
> > > On Fri, Aug 2, 2013 at 9:55 AM, Sreekanth S. Nair <
> > > sreekanth.nair@egovernments.org> wrote:
> > >
> > > > That i know Chris. are you getting away from the question, i was
> > talking
> > > > about struts select tag. Apart from tht, I got problem with normal
> html
> > > > select with struts2, its not generating _multiselect_xyz
> > > >
> > > > --
> > > > Thanks & Regards
> > > > Srikanth
> > > >
> > > > On Fri, Aug 2, 2013 at 9:41 PM, Chris Pratt <thechrispratt@gmail.com
> >
> > > > wrote:
> > > >
> > > > > It can, just use a regular <select>, instead of the <s:select>
> > > > >   (*Chris*)
> > > > >
> > > > >
> > > > > On Fri, Aug 2, 2013 at 12:36 AM, Sreekanth S. Nair <
> > > > > sreekanth.nair@egovernments.org> wrote:
> > > > >
> > > > > > Hi,
> > > > > >     Sometimes we need to provide an empty select tag which will
> be
> > > > > > populated later depending on some value in form using ajax. Now
> its
> > > > > > mandatory to provide at least an empty list to make select to
> work.
> > > Why
> > > > > > can't struts2 select tag can handle this case, where we can
> render
> > > the
> > > > > > select tag even we dont provide a prepopulated list?
> > > > > >
> > > > > >
> > > > > > --
> > > > > > Thanks & Regards
> > > > > > Srikanth
> > > > > >
> > > > >
> > > >
> > >
> >
>

Re: How to initiate the select tag with empty list

Posted by Chris Pratt <th...@gmail.com>.
No, that's why you can give it an empty list, you just can't give it null.
 You may be able to specify list="%{{}}" which should be OGNL syntax for an
empty list.
  (*Chris*)


On Fri, Aug 2, 2013 at 11:06 AM, Sreekanth S. Nair <
sreekanth.nair@egovernments.org> wrote:

> I understood your point chris,
> This _multiselect_xyz parameter is created by a struts multiselect tag  ,
> does it playing any role?
> Not for a debate but as a question, does struts2 select tag is going to
> loose anything if it renders an empty select ?
>
> --
> Thanks & Regards
> Srikanth
>
> On Fri, Aug 2, 2013 at 11:26 PM, Chris Pratt <thechrispratt@gmail.com
> >wrote:
>
> > There's no real advantage to using the <s:select> tag if you already no
> > there's no data to be displayed (remember, the struts tags are for
> display
> > only, they play absolutely no part in processing the posted form).  What
> > you need is an empty <select> tag with a name that matches a mutator in
> > your action.  Struts (and your jQuery) will do the rest.
> > (*Chris*)
> >
> >
> > On Fri, Aug 2, 2013 at 9:55 AM, Sreekanth S. Nair <
> > sreekanth.nair@egovernments.org> wrote:
> >
> > > That i know Chris. are you getting away from the question, i was
> talking
> > > about struts select tag. Apart from tht, I got problem with normal html
> > > select with struts2, its not generating _multiselect_xyz
> > >
> > > --
> > > Thanks & Regards
> > > Srikanth
> > >
> > > On Fri, Aug 2, 2013 at 9:41 PM, Chris Pratt <th...@gmail.com>
> > > wrote:
> > >
> > > > It can, just use a regular <select>, instead of the <s:select>
> > > >   (*Chris*)
> > > >
> > > >
> > > > On Fri, Aug 2, 2013 at 12:36 AM, Sreekanth S. Nair <
> > > > sreekanth.nair@egovernments.org> wrote:
> > > >
> > > > > Hi,
> > > > >     Sometimes we need to provide an empty select tag which will be
> > > > > populated later depending on some value in form using ajax. Now its
> > > > > mandatory to provide at least an empty list to make select to work.
> > Why
> > > > > can't struts2 select tag can handle this case, where we can render
> > the
> > > > > select tag even we dont provide a prepopulated list?
> > > > >
> > > > >
> > > > > --
> > > > > Thanks & Regards
> > > > > Srikanth
> > > > >
> > > >
> > >
> >
>

Re: How to initiate the select tag with empty list

Posted by "Sreekanth S. Nair" <sr...@egovernments.org>.
I understood your point chris,
This _multiselect_xyz parameter is created by a struts multiselect tag  ,
does it playing any role?
Not for a debate but as a question, does struts2 select tag is going to
loose anything if it renders an empty select ?

-- 
Thanks & Regards
Srikanth

On Fri, Aug 2, 2013 at 11:26 PM, Chris Pratt <th...@gmail.com>wrote:

> There's no real advantage to using the <s:select> tag if you already no
> there's no data to be displayed (remember, the struts tags are for display
> only, they play absolutely no part in processing the posted form).  What
> you need is an empty <select> tag with a name that matches a mutator in
> your action.  Struts (and your jQuery) will do the rest.
> (*Chris*)
>
>
> On Fri, Aug 2, 2013 at 9:55 AM, Sreekanth S. Nair <
> sreekanth.nair@egovernments.org> wrote:
>
> > That i know Chris. are you getting away from the question, i was talking
> > about struts select tag. Apart from tht, I got problem with normal html
> > select with struts2, its not generating _multiselect_xyz
> >
> > --
> > Thanks & Regards
> > Srikanth
> >
> > On Fri, Aug 2, 2013 at 9:41 PM, Chris Pratt <th...@gmail.com>
> > wrote:
> >
> > > It can, just use a regular <select>, instead of the <s:select>
> > >   (*Chris*)
> > >
> > >
> > > On Fri, Aug 2, 2013 at 12:36 AM, Sreekanth S. Nair <
> > > sreekanth.nair@egovernments.org> wrote:
> > >
> > > > Hi,
> > > >     Sometimes we need to provide an empty select tag which will be
> > > > populated later depending on some value in form using ajax. Now its
> > > > mandatory to provide at least an empty list to make select to work.
> Why
> > > > can't struts2 select tag can handle this case, where we can render
> the
> > > > select tag even we dont provide a prepopulated list?
> > > >
> > > >
> > > > --
> > > > Thanks & Regards
> > > > Srikanth
> > > >
> > >
> >
>

Re: How to initiate the select tag with empty list

Posted by Chris Pratt <th...@gmail.com>.
There's no real advantage to using the <s:select> tag if you already no
there's no data to be displayed (remember, the struts tags are for display
only, they play absolutely no part in processing the posted form).  What
you need is an empty <select> tag with a name that matches a mutator in
your action.  Struts (and your jQuery) will do the rest.
(*Chris*)


On Fri, Aug 2, 2013 at 9:55 AM, Sreekanth S. Nair <
sreekanth.nair@egovernments.org> wrote:

> That i know Chris. are you getting away from the question, i was talking
> about struts select tag. Apart from tht, I got problem with normal html
> select with struts2, its not generating _multiselect_xyz
>
> --
> Thanks & Regards
> Srikanth
>
> On Fri, Aug 2, 2013 at 9:41 PM, Chris Pratt <th...@gmail.com>
> wrote:
>
> > It can, just use a regular <select>, instead of the <s:select>
> >   (*Chris*)
> >
> >
> > On Fri, Aug 2, 2013 at 12:36 AM, Sreekanth S. Nair <
> > sreekanth.nair@egovernments.org> wrote:
> >
> > > Hi,
> > >     Sometimes we need to provide an empty select tag which will be
> > > populated later depending on some value in form using ajax. Now its
> > > mandatory to provide at least an empty list to make select to work. Why
> > > can't struts2 select tag can handle this case, where we can render the
> > > select tag even we dont provide a prepopulated list?
> > >
> > >
> > > --
> > > Thanks & Regards
> > > Srikanth
> > >
> >
>

Re: How to initiate the select tag with empty list

Posted by "Sreekanth S. Nair" <sr...@egovernments.org>.
Now we are managing it with EmptyList only but i'm still not getting the
notion behind throwing exception if struts2 select tag is provided with
null reference instead why cant it show an empty select tag.

-- 
Thanks & Regards
Srikanth
--------------------------------


On Fri, Aug 2, 2013 at 11:07 PM, CRANFORD, CHRIS
<Ch...@setech.com>wrote:

> You have to separate the notion of a use case where silently handling a
> null makes logical sense versus where it often would imply an error
> condition on the part of the developer.
>
> If the view expects an empty list, there is no quam in passing the value
> stack reference as a Collections.EMPTY_LIST and populate it later using
> whatever method you desire.  This way you can still logically differentiate
> between the case where you mean for the select to be empty versus where the
> select wasn't provided anything and in almost all cases is an error use
> case.
>
> -----Original Message-----
> From: Sreekanth S. Nair [mailto:sreekanth.nair@egovernments.org]
> Sent: Friday, August 02, 2013 11:56 AM
> To: Struts Users Mailing List
> Subject: Re: How to initiate the select tag with empty list
>
> That i know Chris. are you getting away from the question, i was talking
> about struts select tag. Apart from tht, I got problem with normal html
> select with struts2, its not generating _multiselect_xyz
>
> --
> Thanks & Regards
> Srikanth
>
> On Fri, Aug 2, 2013 at 9:41 PM, Chris Pratt <th...@gmail.com>
> wrote:
>
> > It can, just use a regular <select>, instead of the <s:select>
> >   (*Chris*)
> >
> >
> > On Fri, Aug 2, 2013 at 12:36 AM, Sreekanth S. Nair <
> > sreekanth.nair@egovernments.org> wrote:
> >
> > > Hi,
> > >     Sometimes we need to provide an empty select tag which will be
> > > populated later depending on some value in form using ajax. Now its
> > > mandatory to provide at least an empty list to make select to work.
> > > Why can't struts2 select tag can handle this case, where we can
> > > render the select tag even we dont provide a prepopulated list?
> > >
> > >
> > > --
> > > Thanks & Regards
> > > Srikanth
> > >
> >
>
>
> Email secured by Check Point
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

RE: How to initiate the select tag with empty list

Posted by "CRANFORD, CHRIS" <Ch...@setech.com>.
You have to separate the notion of a use case where silently handling a null makes logical sense versus where it often would imply an error condition on the part of the developer.  

If the view expects an empty list, there is no quam in passing the value stack reference as a Collections.EMPTY_LIST and populate it later using whatever method you desire.  This way you can still logically differentiate between the case where you mean for the select to be empty versus where the select wasn't provided anything and in almost all cases is an error use case.

-----Original Message-----
From: Sreekanth S. Nair [mailto:sreekanth.nair@egovernments.org] 
Sent: Friday, August 02, 2013 11:56 AM
To: Struts Users Mailing List
Subject: Re: How to initiate the select tag with empty list

That i know Chris. are you getting away from the question, i was talking about struts select tag. Apart from tht, I got problem with normal html select with struts2, its not generating _multiselect_xyz

--
Thanks & Regards
Srikanth

On Fri, Aug 2, 2013 at 9:41 PM, Chris Pratt <th...@gmail.com> wrote:

> It can, just use a regular <select>, instead of the <s:select>
>   (*Chris*)
>
>
> On Fri, Aug 2, 2013 at 12:36 AM, Sreekanth S. Nair < 
> sreekanth.nair@egovernments.org> wrote:
>
> > Hi,
> >     Sometimes we need to provide an empty select tag which will be 
> > populated later depending on some value in form using ajax. Now its 
> > mandatory to provide at least an empty list to make select to work. 
> > Why can't struts2 select tag can handle this case, where we can 
> > render the select tag even we dont provide a prepopulated list?
> >
> >
> > --
> > Thanks & Regards
> > Srikanth
> >
>


Email secured by Check Point



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


Re: How to initiate the select tag with empty list

Posted by "Sreekanth S. Nair" <sr...@egovernments.org>.
That i know Chris. are you getting away from the question, i was talking
about struts select tag. Apart from tht, I got problem with normal html
select with struts2, its not generating _multiselect_xyz

-- 
Thanks & Regards
Srikanth

On Fri, Aug 2, 2013 at 9:41 PM, Chris Pratt <th...@gmail.com> wrote:

> It can, just use a regular <select>, instead of the <s:select>
>   (*Chris*)
>
>
> On Fri, Aug 2, 2013 at 12:36 AM, Sreekanth S. Nair <
> sreekanth.nair@egovernments.org> wrote:
>
> > Hi,
> >     Sometimes we need to provide an empty select tag which will be
> > populated later depending on some value in form using ajax. Now its
> > mandatory to provide at least an empty list to make select to work. Why
> > can't struts2 select tag can handle this case, where we can render the
> > select tag even we dont provide a prepopulated list?
> >
> >
> > --
> > Thanks & Regards
> > Srikanth
> >
>

Re: How to initiate the select tag with empty list

Posted by Chris Pratt <th...@gmail.com>.
It can, just use a regular <select>, instead of the <s:select>
  (*Chris*)


On Fri, Aug 2, 2013 at 12:36 AM, Sreekanth S. Nair <
sreekanth.nair@egovernments.org> wrote:

> Hi,
>     Sometimes we need to provide an empty select tag which will be
> populated later depending on some value in form using ajax. Now its
> mandatory to provide at least an empty list to make select to work. Why
> can't struts2 select tag can handle this case, where we can render the
> select tag even we dont provide a prepopulated list?
>
>
> --
> Thanks & Regards
> Srikanth
>