File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Selecting value in html:optionCollections Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Selecting value in html:optionCollections" Watch "Selecting value in html:optionCollections" New topic

Selecting value in html:optionCollections

chetan kokil

Joined: Sep 02, 2006
Posts: 9

I am a newbie to struts and want to know, how to keep selected a particular value in
<html ptionsCollection />

Expecting a favourable reply.

Thanking you
Dom Lassy
Ranch Hand

Joined: May 05, 2006
Posts: 181

In this example, your form bean should have a method called "getSelectedValue" and if the value of anything in your collection matches that value, it will be selected.
[ June 05, 2007: Message edited by: Dom Lassy ]
chetan kokil

Joined: Sep 02, 2006
Posts: 9
Can you send me the code please...if you can...
Srilakshmi Vara
Ranch Hand

Joined: Jul 21, 2004
Posts: 169
In your action/action form set the default select value to the desired value.
I agree. Here's the link:
subject: Selecting value in html:optionCollections
It's not a secret anymore!