File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: html:select - maintain incoming value in drop down box
 
Similar Threads
Setting a preselected value in a combo
Update user profile
javascript issue in struts for onchange event
validation.xml - how to ignore the required fields if a checkBox was clicked?
whats problem with following code ** urgent