Strut HTML Tags

Hi,
How do i force this list box to select only one item at time
<html:select multiple >
          <html:options collection="states" property="value" labelProperty="label" />
</html:select>
komlaaaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

fargoCommented:
just remove the multiple

<html:select>
         <html:options collection="states" property="value" labelProperty="label" />
</html:select>

fargo
fargoCommented:
sorry,

forget about the above post, i forgot to put the property attribute.
<html:select style="width:120px" property="nameOfProperty" name="formName">
<html:options collection="states" property="value" labelProperty="label" />
</html:select>

fargo
fargoCommented:
and id you wish to keep it multiple selection but only show one entry

<html:select style="width:120px" property="nameOfProperty" name="formName" multiple="true" size="1">
     <html:options collection="states" property="value" labelProperty="label" />
</html:select>

fargo
Learn SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

komlaaaAuthor Commented:
the user shouldn't be able to select more one entry even if he/she try to press control key
komlaaaAuthor Commented:
>multiple="true
Shouldn't that be multiple="false"
komlaaaAuthor Commented:
+ i would like to set the size = "the size of the items in the list box", not know till run time
fargoCommented:
okk.

if you don't want user to select more than one, definitely you should just remove the multiple and the size attributes.

>> i would like to set the size = "the size of the items in the list box", not know till run time
You need not to set the size. Why do u wish to set the size?? It is automatically taken up by the options collection size.

regards,
fargo

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
komlaaaAuthor Commented:
>if you don't want user to select more than one, definitely you should just remove the multiple and the size attributes
if i do, it will turn to combo or drop down menu which i don't want.
fargoCommented:
Hi,

I don't think it is directly possible. May be you need to make use of javascript to make it happen.

regards,
fargo

komlaaaAuthor Commented:
Please just tell me what the difference between "drop down menu" and List menu  using <html:select> tags?
fargoCommented:
sure you are not talking about menu..correct?

AFAIK, drop down box and list box and select list are all same. There is no difference.

regards,
fargo

komlaaaAuthor Commented:
thanks fargo.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JSP

From novice to tech pro — start learning today.