What is wrong with my very simple web application: the web application was successfully deployed on the application server, but hi bean did not enter index.xhtml on the page (the page shows only Hello from Facelets: # {hello.value})?
(this is the first time I work with JSF, so maybe this question is very simple, and I also used a good article http://arjan-tijms.omnifaces.org/2011/08/minimal-3-tier-java- ee-app-without-any.html )
I have the following military archive structure:
mywebapp | - WEB_INF | - classes | - Hello.class - index.html
Hello.java has:
import javax.enterprise.context.RequestScoped; import javax.inject.Named; @Named @RequestScoped public class Hello { private String value; public String getValue() { return "Hello JSF"; } public void setValue(String value) { this.value = value; } }
as well as my index.xhtml
<?xml version='1.0' encoding='UTF-8' ?> <!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:h="http://xmlns.jcp.org/jsf/html"> <h:head> <title>My Facelet Page Title</title> </h:head> <h:body> Hello from Facelets: #{hello.value} </h:body> </html>
For the construction project, I used pom.xml:
.... <packaging>war</packaging> <name>Simple web app</name> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.4</version> <configuration> <failOnMissingWebXml>false</failOnMissingWebXml> </configuration> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>7.0</version> <scope>provided</scope> </dependency> </dependencies>
source share