2 Replies Latest reply on Aug 9, 2006 1:03 AM by Tahir Akram

    javax.servlet.ServletException: Cannot get value for express

    Tahir Akram Newbie

      I m having problem with running of my JSP page which is calling managed bean properties. I dont know wht thing is missing but I hope with review of u ppl I will got the solution..


      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
      <%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
      <%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
       <title>Celsius converter</title>
       <h1>Celcius Convertersss</h1>
       <h:inputText value="#{pageBean.celsius}" />
       <h:outputText value="Celsius" /><br/>
       <h:outputText value="#{pageBean.fahrenheit}" />
       <h:outputText value="Fahrenheit" /><br/>
       <h:commandButton value="Convert" action="#{pageBean.convertToFahrenheit}" />


      <?xml version="1.0"?>
      <!DOCTYPE faces-config PUBLIC
      "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
       <!--Now this config file is empty-->


      package jsfbean;
      public class PageBean {
       private Double celsius = null;
       private Double fahrenheit = null;
       public PageBean(){
       public void setCelsius(Double celsius){
       this.celsius = celsius;
       public Double getCelsius(){
       return celsius;
       public void setFahrenheit(Double fahrenheit){
       this.fahrenheit = fahrenheit;
       public Double getFahrenheit(){
       return fahrenheit;
       public void convertToFahrenheit(){
       setFahrenheit(new Double(getCelsius().doubleValue() * 1.8 + 32));


      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE web-app PUBLIC
      "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
       <display-name>The simplest JSF application.</display-name>
       <servlet-name>Faces Servlet</servlet-name>
       <servlet-name>Faces Servlet</servlet-name>

      Please share if u have solve this problem....


        • 1. Re: javax.servlet.ServletException: Cannot get value for exp
          Tahir Akram Newbie

          here is the exceptions I m faciong

          javax.servlet.ServletException: Cannot get value for expression '#{pageBean.celsius}'
          root cause
          javax.faces.FacesException: Cannot get value for expression '#{pageBean.celsius}'

          • 2. Re: javax.servlet.ServletException: Cannot get value for exp
            Tahir Akram Newbie

            The issue is resolved...

            The main problem was my class was not recognized by my managed bean. But that was my syupidity, bcoz I was packagaing my ..class directly in WEB-INF/classes/.class

            I was not including my package with my class while packaging.

            so thx all of u who think 2 reply

            - Tahir