• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

JSF-Spring Integration problems

Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using JSF 1.1_01 (MyFaces 1.1), Spring 1.2, Ajax4Jsf.
The JSF application has h:selectOneMenu .

On change event of h:selectOneMenu sets "selectedValue" into backing bean as
shown below:


<h:selectOneMenu value="#{test.selectedDevice}" >

<f:selectItem itemValue="0" itemLabel="--New--"/>
<f:selectItem itemValue="1" itemLabel="WorkStation"/>
<f:selectItem itemValue="2" itemLabel="Router"/>
<f:selectItem itemValue="3" itemLabel="Switch"/>
<ajax:support action="#{test.loadDevice}" event="onchange"

TestBean.java (Backing Bean)

public String getSelectedDevice() {
logger.info(" *** In getSelectedDevice *** ");
if (selectedDevice == null) {

selectedDevice = "0"; // This will be the default selected item.
return selectedDevice;

public void setSelectedDevice(String selectedDevice) {
logger.info(" *** In setSelectedDevice *** ");
this.selectedDevice = selectedDevice;
private DeviceTypeManager deviceManager;
public DeviceTypeManager getDeviceManager() {
return deviceManager;

public void setDeviceManager(DeviceTypeManager deviceManager) {
this.deviceManager = deviceManager;

Here are the configuration file snippets for integrating JSF Spring


<property-class> test.DeviceTypeManager </property-class>

The above code results in the following error

javax.faces.FacesException: Cannot get value for expression '#

Here are the two scenarios

Scenario 1 : without <managed-property> the code works fine

Scenario 2 : with <managed-property> the code results in following error

javax.faces.FacesException: Cannot get value for expression '#

Scenario 1 has only JSF whereas Scenario 2 has JSF-Spring integration

The Scenario 1 works absolutely fine as the expression '#
{test.selectedDevice}' gets its value from setter/getter method in the backing
bean(TestBean.java) . This is expected behaviour & wondering why it doesn't
work similarly in Scenario 2 instead it complains
Cannot get value for expression '#{test.selectedDevice}'

I am willing to upload the war file. Any pointers/suggestions in resolving the
error will be highly appreciated

With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic