Environment
- Weblogic 12.1.3.0.0
- Java 1.7
- JSF 2.2 (provide libraries from app because of issues with Weblogic Server)
- Ant-based build tool (huge company means old tools)
Files
Portal.java
@ManagedBean(name="portal")
@ViewScoped
public class Portal {
public String foo ="foo";
@PostConstruct
public void init() {
System.out.println("instantiated");
}
}
portal.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core">
<ui:composition template="/WEB-INF/templates/wide_template.xhtml">
<ui:define name="mainContent">
<!-- other markup removed -->
<h:outputText value="hello:#{portal.foo}"></h:outputText>
</ui:define>
</ui:composition>
</html>
faces-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<faces-config xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd"
version="2.2">
</faces-config>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.0">
<context-param>
<param-name>facelets.REFRESH_PERIOD</param-name>
<param-value>2</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.validateXml</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.verifyObjects</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.expressionFactory</param-name>
<param-value>com.sun.el.ExpressionFactoryImpl</param-value>
</context-param>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<welcome-file-list>
<welcome-file>portal.xhtml</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/skinned/*</url-pattern>
<url-pattern>*.faces</url-pattern>
<url-pattern>/faces/*</url-pattern>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
</web-app>
Problem
My page renders all elements correctly. For example h:selectOneMenu
and so on. But it seems that my Managed Bean is never instantiated as i don't see output on the console nor does the page render the content of foo
.
I've read some other questions on SO:
- Bean not instantiated - I don't beans.xml at all, I think.
- JSF 2 managed bean does not get instantiated - I only have one ManagedBean which is referenced.
- JSF Managed bean in jar not instantiated - My structure should be fine.
Does anyone know about issues with SessionScope maybe?
Is there something I'm missing? Or do I have to provide more, like the app-structure after deployment, more code, screenshots?