Hi Mike,
The action listener is completely separate to the selectOneMenu component,
which is why I can't see how the value of this should affect it.
I would have hoped that by setting the value of a component to the property
of a nested bean where that bean is null would return null rather than
causing issues behind the scenes, though as I mentioned previously I am
pretty new to this, coming from a .NET background. If I fool the system and
get the main bean (held on the backing bean which is at request scope and
uses '<t:saveState />') to return the ID from the nested bean, or null if
that bean is null, then it works correctly.
Do you think the converter will not work then since my ID is an Integer? I'm
thinking I may need to do a bit more research into these!
I shall keep trying - cheers! Carl
Mike Kienenberger wrote:
>
> I don't see an action listener in the page code you posted.
> Make sure you have an h:messages tag (or two) or equivalent on your
> page to report validation errors. Make sure you catch global errors
> as well as specific ones.
>
> convertNumber should work, although it only returns either a Long or a
> Double value, depending on the number parsed. There's another number
> converter in the sandbox that will allow you to specify the type.
>
> The way others have handled this is to write specific converters for
> our Entity types (Hibernate or Cayenne) rather than for the id value.
>
> Are you allowed to arbitrarily change the
> BackingBean.object.subObject.id value in Hibernate? Is this really
> doing what you want it to do? I use Cayenne, so I can't say, but
> normally I want to set a variable to the data object returned, not set
> an id on an existing data object.
>
>
>
> On 9/20/06, CarlHowarth <[EMAIL PROTECTED]> wrote:
>>
>> Hi Mike,
>>
>> I didn't have a converter within the selectOneMenu - the ID of the
>> selectItems is simply an integer. I'm a bit new to JSF - I have tried
>> adding
>> a convertnumber within the code.... this has stopped the error mentioned
>> below, however this has stopped invoking the actionListener even when the
>> data is populated. Do I need to add any further info to the converter, or
>> look into writing my own?
>>
>> The menu is as follows:
>>
>> <h:selectOneMenu id="industryList"
>> value="#{BackingBean.object.subObject.id}">
>> <f:convertNumber />
>> <f:selectItem itemValue="0" itemLabel="(#{webtext.select})"/>
>> <f:selectItems value="#{BackingBean.clientIndustryList}"/>
>> </h:selectOneMenu>
>>
>> There are no errors showing up even though the actionListener is being
>> completely disregarded.
>>
>> Thanks, Carl
>>
>>
>>
>> Mike Kienenberger wrote:
>> >
>> > Did you register an appropriate converter for the data types of your
>> > select items?
>> >
>> > On 9/20/06, CarlHowarth <[EMAIL PROTECTED]> wrote:
>> >>
>> >> Hi,
>> >>
>> >> I have a strange issue with a JSF page I am working on...
>> >>
>> >> When I set the value of a selectOneMenu component to a property of my
>> >> backing bean, my action listeners stop being fired. If I set the value
>> of
>> >> my
>> >> selectOneMenu to a property of an object stored on my backing bean
>> they
>> >> work
>> >> again. The data is being returned using Hibernate and I want to
>> perform
>> >> some
>> >> logic in the backing bean in case one of the properties is null, since
>> >> setting the menu's value to a property that would ordinarily throw a
>> >> NullPointerException gives this error:
>> >>
>> >> ERROR
>> >> org.apache.myfaces.shared_impl.renderkit.html.HtmlRendererUtils(355) -
>> >> Error finding Converter for component with id ....
>> >>
>> >> ...and that too prevents the action listeners from being triggered.
>> >>
>> >> Other than this I am not getting any errors and am a bit stuck in all!
>> >>
>> >> The app uses myfaces 1.1.4 and tomahawk 1.1.3 - the menu component and
>> >> command links that activate the action events are in a panelTab.
>> >>
>> >> Has anybody had a similar issue, or can anyone please point me in the
>> >> right
>> >> direction?
>> >>
>> >> Many thanks in anticipation, Carl
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/Strange-actionListener-component-value-problem-tf2304734.html#a6406078
>> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Strange-actionListener-component-value-problem-tf2304734.html#a6409626
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>>
>
>
--
View this message in context:
http://www.nabble.com/Strange-actionListener-component-value-problem-tf2304734.html#a6423464
Sent from the MyFaces - Users mailing list archive at Nabble.com.