Hi Thomas,

f:loadBundle stores the bundle in request-scope,
you can use the loadBundle from sandbox as replacement:
http://myfaces.apache.org/sandbox/apidocs/org/apache/myfaces/custom/loadbundle/LoadBundleTag.html


Regards,
    Volker



2007/9/28, Thomas Fischer <[EMAIL PROTECTED]>:
>
> Hi all,
>
> We have an input field that looks like:
>
> <h:inputText
>     id="street"
>     required="true"
>     value="#{someController.street}"
>     binding="#{someController.streetInput}"
>     label="street" />
>
> If the "required" validation fails, the label is be replaced into
> placeholder {0} of the validation message "{0}: Validation Error: Value is
> required."
>
> Trying to internationalize the application, we now load the label from a
> resource bundle:
>
> <f:loadBundle basename="com.mycompany.messages.labels" var="labels"/>
> <h:inputText
>     id="street"
>     required="true"
>     value="#{someController.street}"
>     binding="#{someController.streetInput}"
>     label="#{labels['label.address.street']}" />
>
> Now, the label is not correctly replaced in the message; instead "null" is
> inserted into the placeholder. We have checked that the label is accessed
> correctly, the same expression in an outputText does find the message.
>
> I assume the following happens: The label replacement takes place in the
> processValidations phase (when the validation fails). In this phase. the
> message bundle is not yet registered (this happens in the
> renderResponsePhase when the jsp page with the loadBundle is executed).
>
> I have also found the following remark in the class
> org.apache.myfaces.taglib.core.LoadBundleTag, which points in the same
> direction:
>  * TODO:
>  * We should find a way to save loaded bundles in the state, because
> otherwise
>  * on the next request the bundle map will not be present before the render
> phase
>  * and value bindings that reference to the bundle will always log annoying
>  * "Variable 'xxx' could not be resolved" error messages.
>
> Does anybody have an idea how one could achieve this ?
>
>     Regards
>
>         Thomas
>
>
>

Reply via email to