i have a simple JSF xhtml page contains xml:
<h:body>
<h:outputText value='#{someBean == null ? "null" : "not null"}'/>
</h:body>
my faces-config
contains:
<application>
<el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
</application>
and i have a java configuration bean like
@Bean
public ServletRegistrationBean jsfServletRegistration (ServletContext servletContext) {
servletContext.setInitParameter("com.sun.faces.forceLoadConfiguration", Boolean.TRUE.toString());
ServletRegistrationBean srb = new ServletRegistrationBean();
srb.setServlet(new FacesServlet());
srb.setUrlMappings(Collections.singletonList("*.xhtml"));
srb.setLoadOnStartup(1);
return srb;
}
and a bean like:
@Component
@ViewScoped
@ManagedBean
public class SomeBean {
public String message() {
return "some";
}
}
here, when i go to the page i get null
string as response...
note: i can access my pages using browser.
why cant i get someBean
inside xhtml file ?