欧美三区_成人在线免费观看视频_欧美极品少妇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條評論
主站蜘蛛池模板: 精品视频在线观看视频免费视频 | 26uuu最新| 天天影院成人免费观看 | 精品伊人久久久99热这里只 | 欧美亚洲一区二区三区在线 | 国产免费一区二区三区免费视频 | 精品一区二区三区的国产在线观看 | 国产 福利 在线 | 欧美精品中文字幕久久二区 | 午夜欧美 | 国产精品久久久久久吹潮 | 狠狠伊人 | 天天看天天干 | 美美女高清毛片视频免费观看 | 国产成年人网站 | 日韩手机在线观看 | 性xxxx视频播放免费 | 午夜福利视频 | 日本韩国一区二区三区 | 久久99国产精品成人欧美 | av在线色| 99热在线国产 | 中文字幕 国产精品 | 91精品在线看 | 久久69精品久久久久久久电影好 | 亚洲jjzz| 亚洲欧洲精品成人久久奇米网 | 精品国产一区二区三区久久影院 | 国产日韩一区二区三区 | 丁香婷婷电影 | 精品卡1卡二卡3卡 | 狠狠操夜夜爱 | 日韩不卡高清 | 亚洲成人一区 | 日韩精品免费视频 | 亚洲综合激情另类小说区 | av在线电影网 | 久久久美女 | 亚洲av毛片成人精品 | 欧美a∨ | 亚洲精品在线视频 |