Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Cannot find bean: "EMPLOYEELIST" in any scope

Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

This is my first post. Any help on this is much appreciated. I've been reading in Struts Forum about the proper usage of <html:select>, <html ptions>, <html ptionsCollection>, etc, honestly I am still confused. I am getting "cannot find bean: EMPLOYEELIST in any scope" error message. Can any of your struts experts tell me what I am doing wrong? Here is my code:

<html:form action="/search">
<td align="right"><bean:message key=""/>:</td>
<html:select property="employee">
<html ptionsCollection name="EMPLOYEELIST" value="ssNum" label="name"/>


<form-bean name="searchForm"

<!-- Global Forwards Configuration -->
<forward name="search" path="/search.jsp"/>

<!-- Action Mappings Configuration -->
<action path="/search"

public final class SearchAction extends Action
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception
EmployeeSearchService service = new EmployeeSearchService();
ArrayList results;
ArrayList empList;

SearchForm searchForm = (SearchForm) form;
empList = service.getEmployeeList();



// Forward control to this Action's input page.
return mapping.getInputForward();

public class SearchForm extends ActionForm
private ArrayList employees = new ArrayList();
private String employee;

public String getEmployee() {
return employee;

public void setEmployee(String employee) {
this.employee = employee;

public ArrayList getEmployees() {
return employees;

public void setEmployees(ArrayList employees) {
this.employees = employees;

public class Employee
private String name;
private String ssNum;

public Employee(String name, String ssNum) { = name;
this.ssNum = ssNum;

public void setName(String name) { = name;

public String getName() {
return name;

public void setSsNum(String ssNum) {
this.ssNum = ssNum;

public String getSsNum() {
return ssNum;

Please help, thanks.
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let's look more closely at this:

In the <html:optionsCollection> tag, the name and (optionally) property attribute should refer to a collection of beans you want to iterate over to create the list of options.

You've provided name="EMPLOYEELIST", but the object in the session under the name "EMPLOYEELIST is an object of type SearchForm, not a collection, so that isn't going to work. What you're after is the employees property of SearchForm because that contains the actual list of employees you want to iterate over.

Stop reading and try fixing it yourself first. Then scroll down if you need to see the answer.

<html:optionsCollection name="EMPLOYEELIST" property="employees" value="ssNum" label="name"/>

Just so you know: Struts has already put your SearchForm in the session for you. You could therefore eliminate the line:


and then change the name attribute of your <html:optionsCollection> tag to "searchForm".

P.S. to get rid of those annoying smiley-faces, click the "Disable smilies in this post" box at the bottom of the Post A Reply page.
Steve Huang
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Merrill, you're right! It was the problem setting incorrect object into the actionForm. I also deleted the line setting a collection object to the current session; that worked too. Anyway, your PROMPT response is much much appreciated.

By the way, I couldn't resist to scroll down and see your answers before trying it out myself. I was, say the least, a bit frustrated from trying for a long time before posting for help. Anyway, thanks again.
Of course, I found a very beautiful couch. Definitely. And this tiny ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic