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
精彩评论