You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by SP...@ixl.com on 2001/06/05 22:58:31 UTC

URGENT - PLEASE HELP: DROPDOWN BOX

Hi,

In my form bean I have the following code:
    private void setHmTitles()
    {
    	hmTitles.add( new LabelValueBean ("  ", 0) );
    	hmTitles.add( new LabelValueBean ("Mr.", 1) );
    	hmTitles.add( new LabelValueBean ("Mrs.", 2) );
	hmTitles.add( new LabelValueBean ("Ms.", 3) );
	hmTitles.add( new LabelValueBean ("Miss", 4) );
	hmTitles.add( new LabelValueBean ("Mr.and Mrs.", 5) );
	hmTitles.add( new LabelValueBean ("Dr.", 6) );
    }
where LabelValueBean is a name value pair class similar to the one struts
has.

In my jsp I have the following code:
<s:select property="selTitle" styleClass="frmfld">	
	<sl:iterate id="sp" name="registerForm" property="hmTitles">
		<sb:define id="val" name="sp" property="value" />
		<s:option value='<%=val.toString()%>'><sb:write name="sp"
property="label" /></s:option>
	</sl:iterate>
</s:select>

and the dropdown box displays all the values correctly except for the first
one. 
Since the first one is " " (which is supposed to show the title as blank) it
displays 0. 

What do I do to make it display a blank? I have tried &nbsp; and "''"  which
didn't work either.

Can you please help me as I am approaching deadline soon.

Sharmila Pandith
Software Engineer
iXL Inc.

phone: 212-500-5180
AIM: spandith
Yahoo: spandith
MSN: spandith

This message is intended only for the use of the Addressee and may contain
information that is PRIVILEGED and CONFIDENTIAL. If you are not the intended
recipient, dissemination of this communication is prohibited. If you have
received this communication in error, please erase all copies of the message
and its attachments and notify us immediately.