0

I'm currently added two annotations to the Bean:

import jakarta.enterprise.context.RequestScoped;
import jakarta.inject.Named;

@Named
@RequestScoped
public class DemoBean { ... }

But when I use it inside an .xhtml file in EL:

<h:inputText id="demo-input" value="#{demoBean.prop1}" />

But I've got this runtime error:

javax.el.PropertyNotFoundException: Target Unreachable, identifier 'demoBean' resolved to null

After defining corresponding <managed-bean> inside faces-config.xml file the problem is solved.

Why these two annotations do not automatically add my bean to Jakarta Server Faces (JSF) and I have to add it manually?

I'm using Jakarta EE 9.1.0 and Wildfly-26.1.0.Final as server.

Mehdi Rahimi
  • 808
  • 12
  • 23

0 Answers0