You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Adam Gordon <Ad...@readytalk.com> on 2006/07/05 16:03:44 UTC

Rendering an array as a list box

Can anyone point me to a working example of how to render an array of String
objects as a list box in a JSP such that the contents of the list box can
come from a property set on the request and not the bean mapped to the
struts Action?

It seems like this should be straight forward based on the examples I've
found on the web, but I keep getting errors when I try them which leads me
to believe that the examples have left out (obvious) steps.

Thanks,

-Adam

Re: Rendering an array as a list box

Posted by Adam Gordon <ad...@readytalk.com>.
Yea, that's what I had.  The problem, as usual, was programmer error.  I 
had assumed that the array property was properly being set on the 
request when in fact it wasn't.  I was debugging it with Eclipse and it 
appears that certain types of variables (static) don't show up in the 
variables window so I couldn't see that the collection was messed 
up...it took a few beats to the head to find.

Thanks for the link.

-adam

Michael Jouravlev wrote:
> On 7/5/06, Adam Gordon <Ad...@readytalk.com> wrote:
>> Can anyone point me to a working example of how to render an array of 
>> String
>> objects as a list box in a JSP such that the contents of the list box 
>> can
>> come from a property set on the request and not the bean mapped to the
>> struts Action?
>>
>> It seems like this should be straight forward based on the examples I've
>> found on the web, but I keep getting errors when I try them which 
>> leads me
>> to believe that the examples have left out (obvious) steps.
>
> Try this: 
> http://wiki.apache.org/struts/StrutsWidgets#head-d413131b40091e2337eb036c8a7ce9e43f428aec 
>
> You must use both "name" and "property".
>
> ---------------------------------------------------------------------
> 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: Rendering an array as a list box

Posted by Michael Jouravlev <jm...@gmail.com>.
On 7/5/06, Adam Gordon <Ad...@readytalk.com> wrote:
> Can anyone point me to a working example of how to render an array of String
> objects as a list box in a JSP such that the contents of the list box can
> come from a property set on the request and not the bean mapped to the
> struts Action?
>
> It seems like this should be straight forward based on the examples I've
> found on the web, but I keep getting errors when I try them which leads me
> to believe that the examples have left out (obvious) steps.

Try this: http://wiki.apache.org/struts/StrutsWidgets#head-d413131b40091e2337eb036c8a7ce9e43f428aec
You must use both "name" and "property".

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


Re: Rendering an array as a list box

Posted by Laurie Harper <la...@holoweb.net>.
Adam Gordon wrote:
> Can anyone point me to a working example of how to render an array of String
> objects as a list box in a JSP such that the contents of the list box can
> come from a property set on the request and not the bean mapped to the
> struts Action?

Use the 'name' attribute on the Struts html:* tags to target a specific 
bean other than the enclosing form. Or you can just iterate the values 
using bean:logic or JSTL's c:forEach and use regular HTML markup instead 
of the html:* tags.

> It seems like this should be straight forward based on the examples I've
> found on the web, but I keep getting errors when I try them which leads me
> to believe that the examples have left out (obvious) steps.

Try posting the specifics of what you're trying and how it is failing. 
It *should* be pretty straight-forward, so if we can see what you're 
doing, we can probably spot your mistake ;-)

L.


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