欧美三区_成人在线免费观看视频_欧美极品少妇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條評論
主站蜘蛛池模板: 天堂最新在线资源 | 久久久久久久99精品免费观看 | 日韩精品一二三区 | 久久成人久久爱 | 一区二区国产在线观看 | 国产日韩在线观看一区 | 日韩av电影在线播放 | 一区二区三区国模大胆 | 91视频免费观看 | 精品国产视频 | 亚洲精品视频久久久 | 4hu网站| 国产精品第一区 | 2018中文字幕在线 | 中文字幕无线码一区二区三区 | 91精品国产高清一区二区三区 | 日本动漫三级 | 91久久老司机福利精品网 | 国产成人在线影院 | 久草福利 | 99re在线精品 | 亚洲乱码视频 | 国产a久久精品一区二区三区 | 成人看片黄a在线看 | 视频在线一区二区 | 在线无码| 日韩和的一区二在线 | 四虎新网站| 欧美一区二区三区视频 | 97超级碰碰在线看视频免费超 | 三级精品 | 成人片黄网站A片免费 | 免费免费视频片在线观看 | 在线观看av网站永久 | 欧美区在线 | 在线视频不卡国产在线视频不卡 | 一级片一级片一级片一级片 | 国产精品久久久久久亚洲调教 | 一区二区三区四区免费看 | 精品无码久久久久久国产 | 99在线精品视频在线观看 |