0

I'm currently trying to setup my project using pretty faces. The basic navigation and parameter setting works, but when I'm trying to inject the "locale" into a sessionScoped bin, prettyfaces throws an exception, saying

PrettyFaces: Exception occurred while processing for URL

That's my config:

    <url-mapping id="locale">
  <pattern value="/#{language: CurrentUser.language}" />
  <view-id value="/faces/index.xhtml" />
</url-mapping>

<url-mapping parentId="locale" id="portal"> 
    <pattern value="/portal" /> 
    <view-id value="/faces/index.xhtml" />
</url-mapping> 

If I remove the EL-injection, the rule works, but ofc. CurrentUser.language is not set, then.

Edit: i've now tried it with query-params - but also theres a "null" somewhere:

http://localhost:8090/portal/?language=en

causing:

PrettyFaces: Exception occurred while processing mapping<portal:#{currentUser.language}> for query parameter named<language> null

with config

<url-mapping id="portal"> 
    <pattern value="/portal/" /> 
    <view-id value="/faces/index.xhtml" />
    <query-param name="language">#{currentUser.language}</query-param>
</url-mapping> 

Any ideas?

1 Answer 1

0

Are you trying to inject into a Locale object field? There is probably no default converter for String -> Locale in EL/JSF, so you should probably inject into a Field, then use an <action>#{currentUser.language}</action> to convert that into a Locale object and set it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.