Converter not working for URL Param

Splash Forums PrettyFaces Users Converter not working for URL Param

This topic contains 3 replies, has 2 voices, and was last updated by  Christian Kaltepoth 6 years, 6 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #17896

    barry
    Participant

    Hi,

    I have an issue which looks almost identical to http://ocpsoft.com/support/topic/converter-for-class-not-working-anymore-in-301

    I am using myfaces 2.04 and pretty faces 3.2 and I get the following error when trying to do a conversion that is usually handled via a Converter I created. The converter is working/being called in phase 3 when using the normal <h:inputSecret… But when I use the

    EL-injected path parameters I get an error in phase 1 with the cast, which makes sense as it hasn’t been converted yet. Is there a solution to this?

    Caused by: com.ocpsoft.pretty.PrettyException: PrettyFaces: Exception occurred while processing <admin/foo:#{adminBackinBean.foo}> for URL </admin/foo/2>
    at com.ocpsoft.pretty.faces.beans.ParameterInjector.injectPathParams(ParameterInjector.java:79)
    at com.ocpsoft.pretty.faces.beans.ParameterInjector.injectParameters(ParameterInjector.java:52)
    at com.ocpsoft.pretty.faces.event.PrettyPhaseListener.afterPhase(PrettyPhaseListener.java:97)
    at org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersAfter(PhaseListenerManager.java:111)
    at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:185)
    ... 36 more
    Caused by: javax.el.ELException: Cannot convert 2 of type class java.lang.String to class com.test.Foo
    at org.apache.el.lang.ELSupport.coerceToType(ELSupport.java:424)
    at org.apache.el.ExpressionFactoryImpl.coerceToType(ExpressionFactoryImpl.java:47)
    at com.ocpsoft.pretty.faces.util.FacesElUtils.setValue(FacesElUtils.java:86)
    at com.ocpsoft.pretty.faces.beans.ParameterInjector.injectPathParams(ParameterInjector.java:75)
    ... 40 more

    #20808

    Hey Barry,

    PrettyFaces currently doesn’t provide full support for JSF converters to convert path and query parameters. But there is a ticket for this:

    http://code.google.com/p/prettyfaces/issues/detail?id=51

    I had a quick look at the code and committed a first patch for this issue. This patch provides support for converters registered by type via faces-config.xml or via @FacesConverter.

    Could you perhaps give the latest builds of 3.2.1-SNAPSHOT a try? You will find all required details on how to use the snapshots here:

    https://github.com/ocpsoft/prettyfaces/wiki/Snapshots

    Christian

    #20809

    barry
    Participant

    Thanks that worked perfectly

    #20810

    Great! Thanks for testing it! :)

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

Comments are closed.