Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem getting default value in HTML:SELECT

Status
Not open for further replies.

bennieuwhof

Programmer
May 3, 2005
2
NL
Hi,

I trying to get default value in a list doïng this:
<html:form action="/action/goahead.do">
<html:select property="type">
<c:forEach var="typnr" items="${FormbeanName.typelist}">
<html:eek:ption value="$typnr" key="resource.item.${typnr}" />
</c:forEach>
</html:select>
</html:form>

The formBean FormBeanName is part of the action-mapping goahead.

I expect the row where typnr equals the property type to be selected. However it seems that the contents of "type" is lost at the moment the comparison will have place.

All items are shown in the selection list but none of them is SELECTED

Anyone knowing what I doin'wrong?

THX

Ben
 
Hi

Thnx for your answer,

As a matter of fact I made a beginners mistake. This happens when you use supplied classes nstead of self-written. I used a string-representation of the complete object to compare. However I should compare with the key-field of the selected object.
After changing this, everything worked out fine.

One again,

Thanx

Ben
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top