beehive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carlin Rogers <>
Subject Re: how do I use the nullable="false" option with an integer
Date Wed, 25 May 2005 18:00:18 GMT
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

I think Eddie's sample will help in this as well.


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

View raw message