myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "l.penet@senat.fr" <l.pe...@senat.fr>
Subject Re: @FlowScoped, @Named and @ManagedBean
Date Wed, 12 Feb 2014 08:29:10 GMT
On 12/02/2014 00:42, Thomas Andraschko wrote:
> Can't you just switch to DS?
I gave a look to «migrate codi 1.x to deltaspike 0.5» by someone who 
seems to know a bit on this topic, posts on this mailing list and is 
also known a Gerhard Petracek :-)

http://os890.blogspot.fr/2013/10/migrate-codi-1x-to-deltaspike-05.html

And so I try to apply the dependenc changes from
https://raw.github.com/os890/tomee_mf_stack_001/master/pom.xml

to

https://raw.github.com/os890/tomee_mf_stack_001/codi2ds/pom.xml

I was however stopped at build time by the lack of
- @ProjectStageActivated
- @Advanced

I can easily live without @ProjectStageActivated (used to activate a 
phase listener in debug, something which help me a lot when I started to 
pla with JSF but that I do not need anymore) and I am now trying to 
figure how not to use @Advanced.

I am using this annotation to make converters and validators eligible 
injection targets. I think I can also retrieve beans by EL-expressions, 
with simple code such as

public class MyHelperClass {
     public static <T> T findBean(String name) {
         if ((name == null) || name.isEmpty()) {
             return null;
                 }
         return evaluateExpression("#{" + name + "}");
     }

     @SuppressWarnings("unchecked")
     public static <T> T evaluateExpression(String expr) {
         if ((expr == null) || expr.isEmpty()) {
             return null;
                 }
         FacesContext fc = FacesContext.getCurrentInstance();
         return (T) fc.getApplication().evaluateExpressionGet(fc,
                 expr, Object.class);
     }
}

MyHelperClass.findBean("toto");

I will try that and keep you posted.

Thanks,

Ludovic


|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|

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