Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2006

Tip: Looking for answers? Try searching our database.

JSF javax.servlet.ServletException: Cannot get value for expression '#{customerService.dummyString}'

Thread view: 
alexjaquet@gmail.com - 18 Jun 2006 15:27 GMT
Hi,

I'm new to JSF/Spring/Hibernate and I got an error with a simple jsf
test :
javax.servlet.ServletException: Cannot get value for expression
'#{customerService.dummyString}'

In my jsp page I've put the following code :

<f:view>
<h:form>
<h:inputText value="#{customerService.dummyString}" rendered="true"
    required="false" />
</h:form>
</f:view>

in my java class I've the following code :

public class CustomerGUI {

    private CustomerService customerService;
    private String dummyString;

    public String getdummyString() {
        return "dummyString";
    }
    public void setdummyString(String dummyString) {
        this.dummyString = "dummyString";
    }
    public List<Customer> getAllCustomers () {
        if (customerService != null) {
            return  customerService.getAllCustomers();
        }else {
            return null;
        }
    }

and my faces-config is the following :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD
JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">

<faces-config >
<application>
        <variable-resolver>
            org.springframework.web.jsf.DelegatingVariableResolver
        </variable-resolver>

        <locale-config>
            <default-locale>en</default-locale>
            <supported-locale>en</supported-locale>
            <supported-locale>fr</supported-locale>
            <supported-locale>de</supported-locale>
        </locale-config>
    </application>

    <navigation-rule>
        <from-view-id>/customerList.jsp</from-view-id>
    </navigation-rule>
    <navigation-rule>
        <from-view-id>/customerDetails.jsp</from-view-id>
    </navigation-rule>
    <navigation-rule>
        <from-view-id>/index.jsp</from-view-id>
        <navigation-case>
            <from-outcome>doIndex</from-outcome>
            <to-view-id>/index.jsp</to-view-id>
        </navigation-case>
        <navigation-case>
            <from-outcome>doCustomerList</from-outcome>
            <to-view-id>/customerList.jsp</to-view-id>
        </navigation-case>
    </navigation-rule>
    <managed-bean>
        <managed-bean-name>customerGui</managed-bean-name>
        <managed-bean-class>
            com.test.gui.CustomerGUI
        </managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
        <managed-property>
            <property-name>customerService</property-name>
            <property-class>
                com.test.business.CustomerServiceImp
            </property-class>
            <value>#customerService</value>
        </managed-property>
    </managed-bean>
</faces-config>

any idea ? thx for responding
Frank Langelage - 18 Jun 2006 22:08 GMT
> Hi,
>
[quoted text clipped - 88 lines]
>
> any idea ? thx for responding

Your managed bean's name is 'customerGui'.
So the expression has to start with "#{customerGui...}".
The managed property's name is 'customerService'.
So the expression is "#{customerGui.customerService}".
In the bean you'll have to provide a method with this signature:
public com.test.business.CustomerServiceImp getCustomerService()


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.