This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes Struts and the fly likes Pre-populating a drop down list using STRUTS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Pre-populating a drop down list using STRUTS" Watch "Pre-populating a drop down list using STRUTS" New topic

Pre-populating a drop down list using STRUTS

Damendra Chahal

Joined: Jun 23, 2004
Posts: 1
How do i pre-popualte a drop-down list and display the selected value when fixing errors that occur through my STRUTS application.

I am using the <html ption> construction tag which uses a bean from session to dynamically populate the drop-down.

The page also uses a Form Bean to capture the values added in the text boxes.

Any solutions would be greatful.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 62130

Moving to the Frameworks forum.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 31577

Are you using the <html:select> tag within your <html:form> ? If so, you get this functionality for free.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
Jeanne's correct. Struts will make one of the choices selected based on the value of your form bean property.

I agree. Here's the link:
subject: Pre-populating a drop down list using STRUTS