users@javaserverfaces-spec-public.java.net

[jsr372-experts mirror] [jsr372-experts] Re: Tag to declare and import constants in EL scope

From: Leonardo Uribe <leonardo.uribe_at_irian.at>
Date: Mon, 20 Jun 2016 15:14:01 +0200

Hi

Just as a comment, f:importConstants reminds me f:loadBundle, which was
deprecated and replaced by a solution that loads the bundle from the
faces-config.xml files.

The problem about f:importConstants is how to set up the context where
these constants are available. For example

<f:importConstants type="com.example.Gender" />

<h:selectOneMenu value="#{person.gender}">
    <f:selectItems value="#{Gender}" />

    <f:ajax ...../>
</h:selectOneMenu>


if the ajax is only for the component, f:importConstants can be ignored and
the code will break.

so, the "challenge" is to find a way to define the EL context properly.

In MyFaces there are some EL contexts:

- page
- template
- view
- global

Sometimes you want a definition to pass through the template, sometimes
through the view or sometimes just have a global definition for all your
views.

regards,

Leonardo Uribe


2016-06-20 14:49 GMT+02:00 Bauke Scholtz <balusc_at_gmail.com>:

> Hi,
>
> See https://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-1424
>
> This is a commonly requested feature from the community. Several libraries
> have it implemented such as OmniFaces and PrimeFaces Extensions. It would
> be nice to offer a standard JSF solution such as <f:importConstants>. It's
> relatively trivial to implement.
>
> If there are no objections, I will take it on me.
>
> Cheers, B
>
>
>