You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Viet Kevin <vi...@activia.net> on 2002/03/01 11:38:08 UTC

html:select and html:options tags

Hello all

My question is about the struts html:select and html:options tags

public class xxxForm extends ActionForm 
{
	private Person choosed;
	private Collection persons;


	public get...
	// accessors for this attributes are defined but I do not display
	// them
}

When creating the form I set the choosed properties to firs instance in the persons list
	xxxForm.setChoosed(xxxForm.getPersons.iterator.next());

Then I want to display that list in a html page for selecting a person in that list.
The html select must list all the persons AND the chooseen one must be displayed first 
(setting the html-attibute selected="selected" for the choosen one)

The other problem is that I want to use an index (an int that index the instances in the list) as the value
of the html option tag (not the name of the person)

so the html produced must be something like : 
<select name="xxxForm.choosed">
	<option value="0"> John  </option>
	<option value="1"> Henri </option>
	<option value="2" selected="selected" > Max </option>
</select>

I play a lot of time trying to obtain this result with the struts tags 
but never figured out how to do it

Please tell me if it is possible to do or propose me an other solution
but I must have an index in my list so the value in the option tag must 
be an int


And the last question is I can't see what the attribute named tabindex in the html:select
tag is used for?

Thx in advance

=============================================================
-- KeV -- 
=============================================================

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>