jboss - JSF Managed Bean not being called -


i getting started jsf , trying out following tutorial in eclispe: http://javing.blogspot.de/2013/01/how-to-create-new-jsf-21-project-and.html

i have got working compiles , deploys on jboss eap 6 without error. not getting output managed bean class, consists of 1 function returns text string. here code files:

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"      xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee    /web-app_3_0.xsd"   version="3.0">     <display-name>archetype created web application</display-name>     <context-param>          <param-name>javax.faces.project_stage</param-name>          <param-value>development</param-value>     </context-param>     <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>*.xhtml</url-pattern>     </servlet-mapping>     <welcome-file-list>          <welcome-file>home.xhtml</welcome-file>     </welcome-file-list>    </web-app> 

home.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:f="http://java.sun.com/jsf/core"     xmlns:h="http://java.sun.com/jsf/html"     xmlns:p="http://primefaces.org/ui">    <h:head>     <title>www.javing.blogspot.com</title>    </h:head>    <h:body>         <h:outputtext value="#{hello.message}"/>    </h:body>    </html>   

pom.xml

<project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-  instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org /xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>com.zeeshan.www</groupid> <artifactid>myjsftest</artifactid> <version>0.0.1-snapshot</version> <packaging>war</packaging> <name>jsf test app</name> <dependencies> <dependency>     <groupid>com.sun.faces</groupid>     <artifactid>jsf-api</artifactid>     <version>2.2.6</version>     <scope>provided</scope> </dependency> <dependency>     <groupid>com.sun.faces</groupid>     <artifactid>jsf-impl</artifactid>     <version>2.2.6-jbossorg-2</version>     <scope>provided</scope> </dependency> <dependency>     <groupid>javax.servlet</groupid>     <artifactid>jstl</artifactid>     <version>1.2</version>     <scope>provided</scope> </dependency>  </dependencies>  <build>          <plugins>               <plugin>                    <groupid>org.apache.maven.plugins</groupid>                    <artifactid>maven-compiler-plugin</artifactid>                    <version>2.3.2</version>                    <configuration>                         <source>1.6</source>                         <target>1.6</target>                         <encoding>utf-8</encoding>                    </configuration>               </plugin>          </plugins>     </build>   </project> 

and managed bean class

package myjsftest;

import javax.faces.bean.managedbean;  @managedbean(name="hello")  public class hello {  public string getmessage() {        system.out.println("hello world function called");     return "www.javing.blogspot.com";   } } 

i have verified via static output indeed managed bean class not returning output.how solve issue?

enclose outputtextcomponent inside h:form tag:

<h:form>    <h:outputtext value="#{hello.message}"/>  </h:form> 

you can choose omit outputtext , place el expression in page , work fine:

#{hello.message} 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -