You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Martin Smith <ma...@goldenhill.co.uk> on 2003/09/16 18:20:32 UTC

select tag woes

Hi there,

I have the following code in my jsp...


      <td>
		<html:select name="homeTeam" property="teamId" >
			<html:options collection="teamVOs" property="teamId"
labelProperty="description"/>
		</html:select>
	</td>
	<td>
		<html:select name="awayTeam" property="teamId" >
			<html:options collection="teamVOs" property="teamId"
labelProperty="description"/>
		</html:select>
	</td>

The problem is that both the bean homeTeam and awayTeam have the property
teamId
which results in the following HTML...

<td>
	<select name="teamId"><option value="3">Arsenal</option>
	<option value="6">Aston Villa</option>
	<option value="19">Middlesborough</option>
	<option value="11" selected="selected">Newcastle United</option>
	<option value="7">Porstmouth</option>
</td>
<td>
	<select name="teamId"><option value="3">Arsenal</option>
	<option value="16">Manchester City</option>
	<option value="2" selected="selected">Manchester United</option>
	<option value="19">Middlesborough</option>
	<option value="11">Newcastle United</option>
</td>

THE PROBLEM

As you can see both the name attributes have the value teamId, which of
course is a problem.

Is there a better solution but still using the html tags, rather that
building up the select elements manualy??

Maybe by using the html-el tags???

Thanks,

Martin


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