myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gerald Müllan" <bierbra...@gmail.com>
Subject Re: Strange actionListener/component value problem
Date Thu, 21 Sep 2006 10:55:05 GMT
Hi,

have you inserted a t:messages tag into the page in order to see if
any errors may happen?

regards,

Gerald

On 9/21/06, CarlHowarth <carl.howarth@dlapiper.com> wrote:
>
> Hi again,
>
> I have been having a look at the custom converters and have written one that
> should handle any potential nulls. I set the value of the selectOneMenu to
> be #{BackingBean.mainObject} and the custom converter returns the ID of the
> nested bean if it exists, otherwise it returns null. This seems to work OK,
> although it currently has quite a lot of overhead; it is currently hitting
> the db on refresh each time to do the 'getAsObject' part of the converter.
> Bear in mind of course I probably haven't got it quite right yet!
>
> Now the converter is there I do not have the error created when the nested
> bean is null, however none of the action listeners on my page are being
> fired at all. As I mentioned previously the action listeners are completely
> independent of the selectOneMenu, it's simply that if I do not set the value
> of the menu the listeners will fire.
>
> The action listeners are in a panelGrid, an example of which is as follows:
>
> <h:commandLink actionListener="#{BackingBean.removeItem}">
>     <h:graphicImage url="image/icon/navigate_minus.png" alt="remove"/>
> </h:commandLink>
>
> My selectOneMenu is in a separate panel grid and is set out as follows:
>
>   <h:selectOneMenu id="industryList"  value="#{BackingBean.mainObject}">
>     <f:converter converterId="xxxx.Converter" />
>     <f:selectItem itemValue="0" itemLabel="(#{webtext.select})"/>
>     <f:selectItems value="#{BackingBean.list}"/>
>   </h:selectOneMenu>
>
> The list returned from the backing bean returns an array list of
> SelectItems. This code is contained within an embedded jsp page within a
> panelTabbedPane using the following syntax:
>
> <f:subview id="tabName">
>     <c:import url="tabcontent/pagename.jsp"/>
> </f:subview>
>
> This seems to be quite a strange issue to me though hopefully the answer
> will be a lot more straightforward than it currently seems. I would be
> grateful of any pointers whatsoever!
>
> Many thanks, 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 <carl.howarth@dlapiper.com> 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 <carl.howarth@dlapiper.com> 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#a6425124
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>


-- 
http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Mime
View raw message