Too bad something simple like this the struts tags doesn't have a nice
solution for like a defaultValue property.

On 6/19/06, Rick Reumann <[EMAIL PROTECTED]> wrote:

Pankaj Gupta wrote:
> Hi,
>
> Please suggest how can I specify which value(s) to be displayed as
> selected by default in html:select tag, when specified through
> collection attribute.

I think it's best to set this up in your Action 'before' you forward to
the JSP, or if you know what will always be the default, just set the
Selection property in your ActionForm and it will default to that one as
selected when you display your select options.  So for example, if you
want the user to select a color, set the color in your ActionForm to the
  default:

String color = "red";

When you then do <html:select property="color"> //--options,

if red is one of them it will by default by the one selected.

--
Rick

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to