myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From José Luis Cetina <maxtorz...@gmail.com>
Subject Re: @Singleton @Lock(READ) to resolve, Could not instantiate converter ...
Date Sat, 13 Apr 2013 16:16:16 GMT
1. About the autocomplete the "problem" that i had is that i was getting
the string value typed by the user in the converter and i was expecting to
be the id that i returned in the getasstring method of course i got an
numberformat exception because the string it wasnt the id instead it was
the string typed by the user.  But the problem was because i didnt specify
the event attritube in p:ajax after look this i just add the itemSelect
event and with this i didnt get the the string typed value in the converter
and the exception gone. As i can see, you specify the event in the ajax
tag.

2. The way i use the converter are in separeted classes and in each
converter if i need an ejb injected (limitation of jsf 2.1 this is "fixed"
in jsf 2.2 ) i use Apache CODI for get the reference of my ejb or i do a
lookup using jndi. Using like this way all my converters are classes
annotated with facesconverter that i can reuse in any jsf page using the
converter tag or if the component provide a converter attribute i use the
name of the facesconverter and with this i dont have create an instance of
the converter in any managedbean, my app have more than 40 converters in
this way without any problem . IMO i dont see why you want to use static
converter.
El 13/04/2013 10:41, "Howard W. Smith, Jr." <smithh032772@gmail.com>
escribió:

> I asked the question and answered on stackoverflow.com[1]. Conclusion, I
> decided to leave the converters defined as static and as members of the
> controller classes, since my preference is to use @FacesConverter(forClass
> = Customer.class).
>
> [1]
>
> http://stackoverflow.com/questions/15987483/singleton-lockread-to-resolve-could-not-instantiate-converter
>
>
> On Sat, Apr 13, 2013 at 10:17 AM, Howard W. Smith, Jr. <
> smithh032772@gmail.com> wrote:
>
> >
> > On Sat, Apr 13, 2013 at 9:58 AM, José Luis Cetina <maxtorzito@gmail.com
> >wrote:
> >
> >> Howard i see you have this problem using the converter with primefaces
> >> autocomplete, just for curiosity do you have a p:ajax inside of the
> >> component? If so can you paste your p:ajax tag? I comment this because i
> >> had the same problem like you but i didnt use static in my converter.
> >>
> >
> > Jose, you're right, I do get this exception when using Autocomplete with
> > p:ajax, but I also see the exception on p:inputText (for Phone #) with no
> > p:ajax, and use Save button to update/save Phone # inputText. :)
> >
> > Below, is the entire xhtml of the autocomplete component for customer.
> >
> > <p:autoComplete id="customerId"
> > value="#{pf_ordersController.selectedCustomer}"
> >                 completeMethod="#{pf_customerController.complete}"
> var="c"
> >                 itemLabel="#{c.customerName}" itemValue="#{c}"
> >                 maxResults="10" queryDelay="300" size="50"
> > onblur="close()">
> >     <p:ajax partialSubmit="false" event="itemSelect"
> >             onstart="bui.block();" oncomplete="bui.unblock();"
> >             update="@(.ui-panel) :orderEditForm:formMessages
> > :orderEditForm:_ajax_status"/>
> >     <f:facet name="itemtip">
> >         <h:panelGrid  columns="2" cellpadding="3">
> >             <f:facet name="header">
> >                 <h:outputText value="#{c.customerName}" />
> >             </f:facet>
> >             <h:outputText value="Number:" />
> >             <h:outputText value="#{c.customerId}" />
> >
> >             <h:outputText value="Leader:" />
> >             <h:outputText value="#{c.leaderPointOfContactId ne null ?
> > c.leaderPointOfContactId.pointOfContactName : ''}"/>
> >         </h:panelGrid>
> >     </f:facet>
> > </p:autoComplete>
> >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message