title: JSF error in the page - not able get or set values to the bean
body: <p>I am to do a web application with JSF, just to get and put a value from the JSF to bean and vice versa. I think I have done everything properly but when I start the server and try to access my first page I get the following error</p>
  
  <pre><code>SEVERE: Servlet.service() for servlet [jsp] in context with path [/SimpleJSF] threw exception [/greeting.jsp (line: 20, column: 85) #{...} is not allowed in template text] with root cause
  org.apache.jasper.JasperException: /greeting.jsp (line: 20, column: 85) #{...} is not allowed in template text
  </code></pre>
  
  <p>I am using Eclipse Helios with JDK 1.6 , apache Tomcat 7 and JSF 2.0 framework</p>
  
  <p>Here is my code snippet</p>
  
  <p><strong>greeting.jsp</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="ISO-8859-1" ?&gt;
  &lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1"%&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html 
  xmlns="http://www.w3.org/1999/xhtml" 
  xmlns:f="http://java.sun.com/jsf/core" 
  xmlns:h="http://java.sun.com/jsf/html"&gt;
  &lt;h:head&gt;
          &lt;title&gt;Guess Number Facelets Application&lt;/title&gt;
      &lt;/h:head&gt;
      &lt;h:body&gt;
          &lt;h:form&gt;
  
              &lt;h2&gt;
                  Hi, my name is Duke. I am thinking of a number from
                  0 to 10.
                  Can you guess it?
              &lt;/h2&gt;
              &lt;p&gt;&lt;h:inputText id="userNo" title="Type a number from 0 to 10:" value="#{resultNumber.userNumber}"&gt;
                      &lt;f:validateLongRange minimum="#{resultNumber.minimum}" maximum="#{resultNumber.maximum}"/&gt;
                  &lt;/h:inputText&gt;
  
                  &lt;h:commandButton id="submit" value="Submit" action="response.jsp"/&gt;
              &lt;/p&gt;
              &lt;h:message showSummary="true" showDetail="false" style="color: #d20005; font-family: 'New Century Schoolbook', serif; font-style: oblique; text-decoration: overline"
                         id="errors1"
                         for="userNo"/&gt;
  
          &lt;/h:form&gt;
      &lt;/h:body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <hr>
  
  <p><strong>response.jsp</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="ISO-8859-1" ?&gt;
  &lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1"%&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /&gt;
  &lt;title&gt;Insert title here&lt;/title&gt;
   &lt;h:head&gt;
          &lt;title&gt;Guess Number Facelets Application&lt;/title&gt;
      &lt;/h:head&gt;
      &lt;h:body&gt;
          &lt;h:form&gt;
  
              &lt;h2&gt;
                  &lt;h:outputText id="result" value="#{resultNumber.response}"/&gt;
              &lt;/h2&gt;
              &lt;h:commandButton id="back" value="Back" action="greeting.xhtml"/&gt;
          &lt;/h:form&gt;
      &lt;/h:body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <hr>
  
  <p>Java bean, <strong>ResultNumber.java</strong></p>
  
  <pre><code>package guessNumber;
  
  import java.util.Random;
  
  import javax.ejb.LocalBean;
  import javax.ejb.Stateless;
  
  /**
   * Session Bean implementation class ResultNumber
   */
  @Stateless(mappedName = "resultNumber")
  @LocalBean
  public class ResultNumber {
  
       Integer randomInt = null;
          Integer userNumber = null;
          String response = null;
          private long maximum=10;
          private long minimum=0;
  
          public ResultNumber() {
              Random randomGR = new Random();
              randomInt = new Integer(randomGR.nextInt(10));
              System.out.println("Duke's number: " + randomInt);
          }
  
          public void setUserNumber(Integer user_number) {
              userNumber = user_number;
          }
  
          public Integer getUserNumber() {
              return userNumber;
          }
  
          public String getResponse() {
              if ((userNumber != null) &amp;&amp; (userNumber.compareTo(randomInt) == 0)) {
                  return "Yay! You got it!";
              } else {
                  return "Sorry, " + userNumber + " is incorrect.";
              }
          }
  
          public long getMaximum() {
              return (this.maximum);
          }
  
          public void setMaximum(long maximum) {
              this.maximum = maximum;
          }
  
          public long getMinimum() {
              return (this.minimum);
          }
  
          public void setMinimum(long minimum) {
              this.minimum = minimum;
          }
  
  
  }
  </code></pre>
  
  <p>Now for the configuration files</p>
  
  <p><strong>web.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"&gt;
    &lt;display-name&gt;SimpleJSF&lt;/display-name&gt;
    &lt;servlet&gt;
      &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;javax.faces.webapp.FacesServlet&lt;/servlet-class&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
    &lt;/servlet&gt;
    &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/faces/*&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
    &lt;context-param&gt;
      &lt;description&gt;State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2&lt;/description&gt;
      &lt;param-name&gt;javax.faces.STATE_SAVING_METHOD&lt;/param-name&gt;
      &lt;param-value&gt;client&lt;/param-value&gt;
    &lt;/context-param&gt;
    &lt;context-param&gt;
      &lt;param-name&gt;javax.servlet.jsp.jstl.fmt.localizationContext&lt;/param-name&gt;
      &lt;param-value&gt;resources.application&lt;/param-value&gt;
    &lt;/context-param&gt;
    &lt;listener&gt;
      &lt;listener-class&gt;com.sun.faces.config.ConfigureListener&lt;/listener-class&gt;
    &lt;/listener&gt;
    &lt;welcome-file-list&gt;
      &lt;welcome-file&gt;faces/greeting.jsp&lt;/welcome-file&gt;
    &lt;/welcome-file-list&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <hr>
  
  <p><strong>facet-config.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;faces-config
      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-facesconfig_2_0.xsd"
      version="2.0"&gt;
      &lt;managed-bean&gt;
          &lt;managed-bean-name&gt;resultNumber&lt;/managed-bean-name&gt;
          &lt;managed-bean-class&gt;guessNumber.ResultNumber&lt;/managed-bean-class&gt;
          &lt;managed-bean-scope&gt;session&lt;/managed-bean-scope&gt;
      &lt;/managed-bean&gt;
  &lt;/faces-config&gt;
  </code></pre>