Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to make html:optionsCollection selected inside logic:iterate ?

 
Vish hari
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends,


<logic:iterate id="newRequests" name="newUserRequests" scope="request">
<html:select property="role">
<html ptionsCollection label="roleName" value="roleId" name="roleList" /></html:select>
<bean:write name="newRequests" property="roleId"/></td>
</logic:iterate>

In this design, I want to make particular roleId (which get printed out using bean:write)as selected in the html:select.

Can anyone please help on this.

Thanks,
Vishnuvardhan
 
Tom Rispoli
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In your action class, if you set the value of role equal to roleId the row in your option list with a value of roleId should be selected automatically.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic