I don't see in your JSP "#{bean.list}", according to the error, that
expression should be somewhere in the page.
On 8/21/06, tukutela <[EMAIL PROTECTED]> wrote:
Hi all,
I'm just starting out with Java/JSF having come from a .net c# background.
I'm having some trouble in starting out with JSF and I was hoping that
someone can point me in the right direction, this error is driving me
nuts!!!
I'm using MyEclipse and the server is Apache2, Tomcat5.5, and MyFaces 1.1.1.
I'm trying to fill a selectOneMenu list using a backend bean and are getting
an error that says that the server cannot get value from expression
#{bean.list}
Here's the JSP code
<h:selectOneMenu id="countryListItems" styleClass="lists"
value="#{country.selectedCountry}">
<f:selectItems value="#{country.countryList}" />
</h:selectOneMenu>
Here's the Bean
package com.blah.mgr;
public class Country {
private ArrayList<SelectItem> countryList; //variable array list to
display
set to countries.
// Constructor, initializes class variables, sets up connection with
database.
public Country()
{
buildList();
}
// Returns the arrayList, ensure that the constructor reads the database
first.
public ArrayList getCountryList()
{
return this.countryList;
}
// Sets the country List (not really required but in here anyway.
public void setCountryList(ArrayList<SelectItem> CountryList)
{
this.countryList = CountryList;
}
private void buildList()
{
countryList.add(new SelectItem("Canada", "Canada"));
countryList.add(new SelectItem("US", "US"));
}
}
Here's the link in faces-config.xml:
<managed-bean>
<managed-bean-name>country</managed-bean-name>
<managed-bean-class>com.blah.mgr.Country</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
I'm sure the solution is simple but I've found it difficult to get good
documentation, might be where I'm looking (or not looking) but I'm still
getting lost. Any help is greatly appreciated, thanks in advance.
--
View this message in context:
http://www.nabble.com/Newbie-Question-tf2141924.html#a5912338
Sent from the MyFaces - Users forum at Nabble.com.