开发者

Integrate Weld CDI into a JSF 1.2 EJB Application on jboss 6 AS

开发者 https://www.devze.com 2023-02-12 10:45 出处:网络
Since two evenings, I am trying to integrate weld CDI into an EJB 3.1 Application with JSF 1.2. I simply tried to call a with @Named annotated controller in an JSF page. The problem is, that no except

Since two evenings, I am trying to integrate weld CDI into an EJB 3.1 Application with JSF 1.2. I simply tried to call a with @Named annotated controller in an JSF page. The problem is, that no exception is thrown, when I deploy the project and also no exception is thrown when I call the page.

The simple example contains only:

The Controller:

import javax开发者_运维问答.inject.Named;

@Named
public class HelloWorldController {

    public HelloWorldController(){
        System.out.println("Hello World!");
    }

    public String getMessage() {
        return "Hello Weld World";
    }
}

And it's call:

<h1><h:outputText value="#{helloWorldController.message}" /></h1>

THX


Did you add the required empty beans.xml file to the META-INF WEB-INF? This is often the main cause of CDI mysteriously not working.

See http://seamframework.org/Documentation/WhatIsBeansxmlAndWhyDoINeedIt

0

精彩评论

暂无评论...
验证码 换一张
取 消