欧美三区_成人在线免费观看视频_欧美极品少妇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條評論
主站蜘蛛池模板: 日韩欧美一区二区三区 | 欧美日韩在线一区二区 | 久久青 | 国产午夜三级一区二区三桃花影视 | 成年免费大片黄在线观看岛国 | 亚洲日韩视频 | 久久色亚洲 | 亚洲国产七七久久桃花 | 欧美日韩国产一区二区三区不卡 | 欧美黄视频网站 | 国产精品v欧美精品∨日韩 一级免费黄色免费片 | 一级片在线播放 | 久久精品免费视频观看 | 国产人成午夜免视频网站 | 人人看人人舔 | 午夜免费看片 | 亚洲精品在线免费观看视频 | 久久精品视频在线观看榴莲视频 | 免费色视频 | 婷婷丁香色综合图亚洲 | 毛片在线视频观看 | 爱婷婷网站在线观看 | 青青久草在线 | 国产在线精彩视频 | 久久精品二区亚洲w码 | 欧美日日| 99久热re在线精品99 6热视频 | 91短视频在线高清hd | 午夜在线影院 | 国产日韩欧美亚洲 | 精品久久久久一区二区三区 | 黄色小视频在线观看 | 一本一本大道香蕉久在线精品 | 男女猛烈激情xx00免费视频 | 电视剧知青1至45集免费观看 | 国产乱码在线观看 | 欧美日韩三区 | 粉色视频高清大全免费观看1 | 欧美午夜精品久久久久免费视 | 成人免费毛片片v | 久久九|