欧美三区_成人在线免费观看视频_欧美极品少妇xxxxⅹ免费视频_a级毛片免费播放_鲁一鲁中文字幕久久_亚洲一级特黄

ManagedProperty not injected in @FacesConver

系統 1991 0

I'm trying to inject a ManagedBean in my FacesConverted the following way:

      
        @ManagedBean

@RequestScoped

@FacesConverter(forClass 
      
      = Group.
      
        class
      
      
        )


      
      
        public
      
      
        class
      
       GroupConverter 
      
        implements
      
      
         Converter {



@ManagedProperty(
      
      "#{groupService}"
      
        )


      
      
        private
      
      
         GroupService groupService;



@Override


      
      
        public
      
      
         Group getAsObject(FacesContext context, UIComponent arg1,

        String groupName) {

    
      
      
        return
      
      
         groupService.findGroupByName(groupName);

}



@Override


      
      
        public
      
      
         String getAsString(FacesContext arg0, UIComponent arg1, Object group) {

    
      
      
        return
      
      
         ((Group) group).getName();

}




      
      
        public
      
      
         GroupService getGroupService() {

    
      
      
        return
      
      
         groupService;

}




      
      
        public
      
      
        void
      
      
         setGroupService(GroupService groupService) {

    
      
      
        this
      
      .groupService =
      
         groupService;

}



}
      
    

The problem is that groupService isn't being injected and I get a NullPointerEx. Shouldn't it be autowired automatically since it's also a ManagedBean? It all works when I change "getAsObject" to "return new Group();" obviously.

Any ideas?

?

The solution:

It is likely that you are not resolving the managed bean name .

        
          @ManagedBean(name = "myConverter")

@RequestScoped

@FacesConverter(value = "myConverter")

public class MyConverter implements Converter {
        
      

?

For example, consider these two components:

        
          <h:inputText converter="myConverter" value="#{foo.prop}" />

<h:inputText converter="#{myConverter}" value="#{bar.prop}" />
        
      

?

When the converter is set on the first component, it will be created by Application.createConverter . A converter is not a managed bean . The same rules apply if you match a converter by type .

In the second component, a value expression is used to return a class that implements Converter . This uses the usual managed bean mechanisms. In this case, the @FacesConverter annotation is irrelevant.

ManagedProperty not injected in @FacesConverter


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 亚洲国产精品a一区 | 91精品国产高清久久久久久91 | 久操成人| 猫咪人成免费网站在线观看 | 五月综合激情婷婷六月 | 国产精品福利短视在线播放频 | 欧美性猛交xxxx乱大交蜜桃 | 动漫福利在线观看 | 91精品国产免费久久 | 国产成人综合一区二区三区 | 中文字幕一区二区三区乱码图片 | 午夜资源站 | xxx欧美老熟 | 亚洲福利一区 | 99久久久无码国产精品 | 色五月丁香五月综合五月 | 国产毛片av| 亚洲伊人成综合网 | 欧美巨波霸乳影院67194 | 日韩免费高清视频 | 色色色五的天 | 91影院| av网址在线 | xxx欧美老熟 | 亚洲欧美激情视频 | 免费a网站 | 激情视频免费在线观看 | 毛片免费观看 | 日韩在线观看视频一区 | 爱爱视频在线观看 | 国产在线视频一区二区 | 欧洲午夜视频 | 国产激情一区二区三区 | 草草影院在线 | 久久丁香| 午夜私人影院 | 老美AA片| 亚洲综合色视频在线观看 | 国产成人免费 | 国产成人黄网在线免 | 中文字幕精品一区二区三区精品 |