beehive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eddie O'Neil" <>
Subject Re: how do I use the nullable="false" option with an integer
Date Wed, 25 May 2005 18:12:45 GMT

   Right; try something like this (from a sample that will be in later 
in the afternoon):

<netui:select dataSource=""
               optionsDataSource="${pageInput.petList}" repeater="true">
     <netui:selectOption value="${}"

In this select box, the petList is a JavaBean array where each item in 
the list is rendered by the <selectOption> tag.  In this particular 
case, the key and value are the same; addeding a body to the 
<selectOption> would change the content displayed in the list.  To data 
bind to a property on the "current" Pet bean from the petList, use the 
${container.item} data binding expression.  For example, your 
<selectOption> tag might look like:

   <netui:selectOption value="${container.item.rid}" repeating="option"/>

   You will still need to set the correct "defaultValue" on the <select>.

   But, give this a try and let me know how it works.


Carlin Rogers wrote:
> Hi James,
> Thanks for the code segment. I gather that actionForm.deassignRid
> is the value you want as int, correct? The Form Bean gets
> instantiated and the int data type has a value 0 and cannot be null,
> so the select tag will display it. The nullable="false" would have
> no effect in this case.
> One option would be to not use the JSTL forEach and replace
> the logic by using the select as a repeater. Then using the
> selectOption tag and JSTL if conditional with the repeater
> type, you could avoid displaying the value of the dataSource
> attribute. The select tag javadoc does have a small code
> segment that uses repeater="true" and selectOption tags with
> repeatingType="option".
> I think Eddie's sample will help in this as well.
> Carlin
> James Black wrote:
>> Hash: SHA1
>> Carlin Rogers wrote:
>>> Hi James,
>>> Are you using an int data type or Integer class?
>>> What attribute are you using the integer with and are
>>> you using any selectOption tags?
>>   Because I couldn't figure out a better solution I changed the
>> attribute to be a String.
>>   But, it was an int, and I would prefer for it to be an int, otherwise
>> I have to convert it in the controller.
>> One line is:
>> <c:if test="${sharedFlow.shared.inUseItemArray != null}">
>>   <netui:select dataSource="actionForm.deassignRid" size="10"
>> nullable="false"
>> defaultValue="${sharedFlow.shared.inUseItemArray[0].rid}">
>>     <c:forEach ...>
>>       <netui:selectOption ... />
>>     </c:forEach>
>>   </netui:select>
>> </c:if>
>> [NOTE: the snippet above was typed in for this email, in actuality the
>> snippet does work, so, if there are any errors it is due to a typo.]
>>> If you could include the segment of JSP that uses the select
>>> tag and also any associated code segments from the page flow
>>> Controller that defines the values you are using, I might be
>>> able to help with this.
>>   The problem is in my form, as, when it is first constructed all ints
>> are zero.  So, a zero is put at the bottom of the select, as a zero is
>> not null, so 'nullable="false"' is useless for ints.
>> - --
>> "Love is mutual self-giving that ends in self-recovery." Fulton Sheen
>> James Black
>> Version: GnuPG v1.4.1 (MingW32)
>> Comment: Using GnuPG with Thunderbird -
>> iD8DBQFClKBbikQgpVn8xrARAu1bAJ98YzJlPog5ClhbVAAx5M4MOOilkgCeM2kx
>> mW4q+QeRZDi8Wk2/5rEx3Po=
>> =f4Ax
>> -----END PGP SIGNATURE-----

View raw message