Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSF-Spring Integration problems

Bansilal Haudakari
Posts: 15
  • Mark post as helpful
  • send pies
  • 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"

----------------------- (Backing Bean)

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

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

public void setSelectedDevice(String selectedDevice) {" *** 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( . 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

  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic