Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

html:select - maintain incoming value in drop down box

 
M Mills
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That sounds simple enough and a good idea. I'll give it a try. Thank you very much for your response!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic