This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Struts and the fly likes html:select - maintain incoming value in drop down box Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "html:select - maintain incoming value in drop down box" Watch "html:select - maintain incoming value in drop down box" New topic
Author

html:select - maintain incoming value in drop down box

M Mills
Greenhorn

Joined: Sep 16, 2005
Posts: 2
Hi,
I am having trouble deciding how to display a property populated from Hibernate (via setAttribute()) on the jsp. On the jsp, I have a Struts <html:select> tag. If a value is retrieved from the (DB2) database and sent to the jsp's select which does not match any of the <html ption> elements (drop down box), the first option's value is always displayed. What I need is to display, in this case, the unmatched value coming from the database and highlight the background to indicate a data error. Here is an excerpt of my code:



I am new to Struts tags and saw some <logic:> tags on the Apache Jakarta website. Perhaps I should use <logic:iterate> and/or <logic:nonMatch> ? But I never was able to find exactly what I needed.

Any advice is greatly appreciated. Thanks.
Srilakshmi Vara
Ranch Hand

Joined: Jul 21, 2004
Posts: 169
Instead of using html ption, can use html ptions which takes any java.util structure(List, ArrayList, Map, HashMap)

Make sure to populate the list before displaying the jsp using action class.


Srilakshmi
M Mills
Greenhorn

Joined: Sep 16, 2005
Posts: 2
That sounds simple enough and a good idea. I'll give it a try. Thank you very much for your response!
 
GeeCON Prague 2014
 
subject: html:select - maintain incoming value in drop down box